Chat Completions
Create a chat completion
Changed onCreates a model response in the OpenAI Chat Completions dialect and charges the account for the tokens it used. Requires an API key. /v1/responses and /v1/messages serve the same models in the other two dialects.
post/v1/chat/completions
Request
- Base URLhttps://api.naga.ac
- Auth
- HTTP bearer
- or API key in header x-api-key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Headers
x-naga-routing-strategy'reliability' | 'balanced' | 'latency' | 'throughput' | 'cache'
The order in which NagaAI tries the providers that serve a model. A NagaAI extension.
The routing strategy when the body names none. An unknown name is ignored. A NagaAI extension.
Request body
Response
The completion. application/json carries one chat.completion object when stream is false; text/event-stream carries one chat.completion.chunk per event, then the data: [DONE] sentinel, when it is true.
Example response
{
"object": "chat.completion",
"choices": [
{
"message": {
"role": "assistant",
"tool_calls": [
{
"type": "function"
}
],
"images": [
{
"type": "image_url"
}
],
"annotations": [
{
"type": "url_citation"
}
]
},
"finish_reason": "stop"
}
]
}Changes
- info
added the new optional request property
- info
- info
added the optional property
///////////to the response with the status
- info