Chat Completions
Send a conversation to a model that supports Chat Completions.
Endpoint
POST https://mia-ai-proxy.ambr.io/v1/chat/completions
Request
Set MIA_MODEL to a Chat Completions model ID from Explore.
curl "https://mia-ai-proxy.ambr.io/v1/chat/completions" \
-H "Authorization: Bearer $MIA_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\":\"$MIA_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}"
Read the answer from choices[0].message.content. For a subsequent turn, preserve the complete assistant message, including any tool calls or reasoning_items, in the conversation history.
Fields
| Field | Type | Description |
|---|---|---|
model |
string | Required. ID of a model that supports Chat Completions. |
messages |
array | Required. Conversation messages with a role and content. |
stream |
boolean | Optional. Set to true to receive events as they are generated. |
Response
A non-streaming text response includes:
{
"choices": [{"message": {"role": "assistant", "content": "Hello!"}, "finish_reason": "stop"}]
}
Fields and content vary by model and request.
Streaming
Set stream to true to receive events as output is generated. See Streaming.