Api referenceChat
Create a chat completion
OpenAI-compatible chat completion (streaming and non-streaming). With stream: true the response is a text/event-stream of chat.completion.chunk frames terminated by data: [DONE]. Maniac extensions: tags, metadata, trace, and a provider field on the response.
Authorization
bearerAuth AuthorizationBearer <token>
A Maniac API key, sent as Authorization: Bearer <key>. (Internal service-to-service calls use a separate internal service key and are not documented here.)
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "string", "messages": [ { "role": "system", "content": "string" } ], "property1": null, "property2": null }'{ "id": "string", "object": "chat.completion", "created": 0, "model": "string", "choices": [ { "index": 0, "message": { "role": "string", "content": "string", "tool_calls": [ { "id": "string", "type": "function", "function": { "name": "string", "arguments": "string" } } ], "reasoning": "string" }, "finish_reason": "string", "logprobs": null } ], "usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0, "audio_tokens": 0 } }, "provider": "string"}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}{ "error": { "message": "string", "type": "string", "param": "string", "code": "string" }}