AI ProxyChat completion
AI Proxy

Chat completion

Proxy a chat completion request through the Mythic Analytics AI gateway. Supports streaming responses and context-aware conversations about analytics data.

curl -X POST "https://api.mythic-analytics.com/api/v1/ai/chat" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "messages": [
    {
      "role": "user",
      "content": "Summarize the traffic trends for acme-retail over the last 30 days."
    }
  ],
  "client_id": "acme-retail",
  "stream": true,
  "model": "gpt-4o"
}'
{
  "success": true,
  "data": {
    "message": {
      "role": "assistant",
      "content": "Over the last 30 days, acme-retail saw 42,600 page views with a 12% increase compared to the previous period..."
    },
    "usage": {
      "prompt_tokens": 150,
      "completion_tokens": 280,
      "total_tokens": 430
    }
  }
}
POST
/ai/chat
POST
Security Scheme
Bearer Tokenstring
Required

Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY

Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY
Content-Typestring
Required

The media type of the request body

Options: application/json
messagesarray
Required

Conversation message history.

client_idstring

Optional client ID to scope the conversation context.

streamboolean

Whether to stream the response via server-sent events.

modelstring

AI model to use. Defaults to platform default.

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY

Body

application/json
messagesarray
Required

Conversation message history.

client_idstring

Optional client ID to scope the conversation context.

streamboolean

Whether to stream the response via server-sent events.

modelstring

AI model to use. Defaults to platform default.

Responses

successboolean
dataobject