# Chat

Chat completion endpoints (OpenAI-compatible).

## List chat completions

> List chat completions captured in telemetry, scoped to the authenticated project.

```json
{"openapi":"3.1.0","info":{"title":"Maniac Inference Gateway API","version":"1.0.0"},"tags":[{"name":"Chat","description":"Chat completion endpoints (OpenAI-compatible)."}],"servers":[{"url":"https://platform.maniac.ai","description":"The Maniac API"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"API key in Authorization header using Bearer <token>."}},"schemas":{"ChatListRes":{"properties":{"object":{"type":"string","const":"list","title":"Object","description":"Object type identifier.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/ChatResRelaxed-Output"},"type":"array","title":"Data","description":"Returned items."},"total":{"type":"integer","minimum":0,"title":"Total","description":"Total number of items available for this resource."}},"additionalProperties":false,"type":"object","required":["data","total"],"title":"ChatListRes","description":"OpenAI-style list response for chat completions."},"ChatResRelaxed-Output":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Completion id."},"choices":{"items":{"$ref":"#/components/schemas/RegisterOutputChoice"},"type":"array","title":"Choices"},"created":{"anyOf":[{},{"type":"null"}],"title":"Created","description":"Creation timestamp (unix seconds)."},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"Model slug used."},"object":{"type":"string","const":"chat.completion","title":"Object","description":"Object type.","default":"chat.completion"},"usage":{"anyOf":[{"$ref":"#/components/schemas/ChatResponseUsage"},{"type":"null"}],"description":"Token usage."},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider","description":"Upstream provider name, if available."},"container":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Container","description":"Container label used for routing, if any."},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id","description":"Model ID (uuid)."},"spend":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Spend","description":"Estimated spend."},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags","description":"Tags for this completion."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Metadata for this completion."},"trace":{"anyOf":[{"$ref":"#/components/schemas/TraceContext"},{"type":"null"}],"description":"Optional external trace/span context associated with this completion."}},"type":"object","required":["choices"],"title":"ChatResRelaxed"},"RegisterOutputChoice":{"properties":{"index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Index","description":"Choice index."},"message":{"$ref":"#/components/schemas/RegisterOutputMessage"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finish Reason","description":"Reason the generation finished."}},"additionalProperties":true,"type":"object","required":["message"],"title":"RegisterOutputChoice"},"RegisterOutputMessage":{"properties":{"role":{"type":"string","title":"Role","description":"Message role (system, user, assistant)."},"content":{"anyOf":[{"type":"string"},{"items":{},"type":"array"},{"type":"null"}],"title":"Content","description":"Message content (string or structured parts)."}},"additionalProperties":true,"type":"object","required":["role"],"title":"RegisterOutputMessage"},"ChatResponseUsage":{"properties":{"prompt_tokens":{"type":"number","title":"Prompt Tokens","description":"Prompt tokens."},"completion_tokens":{"type":"number","title":"Completion Tokens","description":"Completion tokens."},"total_tokens":{"type":"number","title":"Total Tokens","description":"Total tokens."},"completion_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Completion Tokens Details"},"prompt_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Prompt Tokens Details"}},"additionalProperties":true,"type":"object","required":["prompt_tokens","completion_tokens","total_tokens"],"title":"ChatResponseUsage","description":"Token usage in a chat completion response."},"TraceContext":{"properties":{"id":{"type":"string","title":"Id","description":"External trace identifier used to group requests."},"span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Span Id","description":"Optional span identifier within the trace."},"parent_span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Span Id","description":"Optional parent span identifier."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Optional trace name."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"Optional trace source, e.g. langchain."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional metadata associated with the trace."}},"additionalProperties":false,"type":"object","required":["id"],"title":"TraceContext"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ManiacError","description":"Error payload."}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorResponse","description":"Response body for errors."},"ManiacError":{"properties":{"code":{"type":"string","title":"Code","description":"Machine-readable error code."},"message":{"type":"string","title":"Message","description":"Human-readable error message."},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details","description":"Additional error details."}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"ManiacError","description":"Standard Maniac API error envelope.\n\nThis matches the shape already used by v2 auth (`detail={\"error\": {...}}`)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/chat/completions":{"get":{"tags":["Chat"],"summary":"List chat completions","description":"List chat completions captured in telemetry, scoped to the authenticated project.","operationId":"chat_completions_list","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"model","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},{"name":"container","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Container"}},{"name":"order","in":"query","required":false,"schema":{"enum":["asc","desc"],"type":"string","default":"desc","title":"Order"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Metadata"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatListRes"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"429":{"description":"Too Many Requests","headers":{"X-RateLimit-Limit":{"description":"Request limit per window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Not Implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Upstream Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Create a chat completion

> Create a chat completion using the specified model.\
> \
> Supports both streaming and non-streaming responses and is compatible with\
> OpenAI's chat completions API. Use a container slug (\`maniac:\<container>\`)\
> or an external slug (e.g. \`openai/gpt-4o\`). \`/\` and \`:\` are treated\
> equivalently on input.

```json
{"openapi":"3.1.0","info":{"title":"Maniac Inference Gateway API","version":"1.0.0"},"tags":[{"name":"Chat","description":"Chat completion endpoints (OpenAI-compatible)."}],"servers":[{"url":"https://platform.maniac.ai","description":"The Maniac API"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"API key in Authorization header using Bearer <token>."}},"schemas":{"ChatReq":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages","description":"Conversation messages."},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"Model slug to use. Supports global slugs and container routes; `/` and `:` are treated equivalently on input."},"models":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Models","description":"Fallback models."},"frequency_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Frequency Penalty","description":"Frequency penalty."},"logit_bias":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Logit Bias","description":"Logit bias."},"logprobs":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Logprobs","description":"Include logprobs."},"top_logprobs":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top Logprobs","description":"Top logprobs."},"max_completion_tokens":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Completion Tokens","description":"Max completion tokens."},"max_tokens":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Tokens","description":"Max tokens."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Arbitrary key/value metadata to attach to the request."},"n":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N","description":"Number of chat completion choices to generate (OpenAI ``n``)."},"presence_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Presence Penalty","description":"Presence penalty."},"reasoning":{"anyOf":[{"$ref":"#/components/schemas/ReasoningConfig"},{"type":"null"}],"description":"Reasoning config."},"response_format":{"anyOf":[{"$ref":"#/components/schemas/ResponseFormatText"},{"$ref":"#/components/schemas/ResponseFormatJsonSchema"},{"$ref":"#/components/schemas/ResponseFormatJsonObject"},{"type":"null"}],"title":"Response Format","description":"Response format."},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed","description":"Random seed."},"service_tier":{"title":"Service Tier","description":"Service tier hint (auto/default/flex/scale/priority).","type":"string","enum":["auto","default","flex","scale","priority"],"nullable":true},"stop":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Stop","description":"Stop sequences."},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","description":"Stream response.","default":false},"stream_options":{"anyOf":[{"$ref":"#/components/schemas/StreamOptions"},{"type":"null"}],"description":"Stream options."},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature","description":"Temperature."},"tool_choice":{"anyOf":[{"type":"string","enum":["none","auto","required"]},{"$ref":"#/components/schemas/ToolChoiceFunction"},{"type":"null"}],"title":"Tool Choice","description":"Tool choice."},"tools":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolDefinition"},"type":"array"},{"type":"null"}],"title":"Tools","description":"Tools."},"parallel_tool_calls":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Parallel Tool Calls","description":"Whether the model may emit multiple tool calls in parallel."},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P","description":"Top p."},"top_k":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top K","description":"Top-k sampling (OpenRouter / Anthropic / vLLM)."},"min_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min P","description":"Min-p sampling cutoff (OpenRouter / vLLM)."},"top_a":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top A","description":"Top-a sampling cutoff (OpenRouter alternate sampler)."},"repetition_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Repetition Penalty","description":"Repetition penalty (OpenRouter / non-OpenAI providers)."},"image_config":{"anyOf":[{"$ref":"#/components/schemas/ImageConfig"},{"type":"null"}],"description":"Image output configuration when ``modalities`` includes 'image'."},"modalities":{"anyOf":[{"items":{"type":"string","enum":["text","image","audio"]},"type":"array"},{"type":"null"}],"title":"Modalities","description":"Output modalities to enable (text, image, audio)."},"audio":{"anyOf":[{"$ref":"#/components/schemas/AudioOutputConfig"},{"type":"null"}],"description":"Audio output configuration when ``modalities`` includes 'audio'."},"prediction":{"anyOf":[{"$ref":"#/components/schemas/PredictionContent"},{"type":"null"}],"description":"Predicted output content for faster generation."},"web_search_options":{"anyOf":[{"$ref":"#/components/schemas/WebSearchOptions"},{"type":"null"}],"description":"Web search tool configuration for supported models."},"transforms":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Transforms","description":"OpenRouter transform pipeline names (e.g. 'middle-out')."},"preset":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preset","description":"OpenRouter preset name (server-side stored param bundle)."},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Optional tags for tracking."},"store":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Store","description":"Whether to store the completion in the database.","default":true},"trace":{"anyOf":[{"$ref":"#/components/schemas/TraceContext"},{"type":"null"}],"description":"Optional external trace/span context used to group related requests across containers."}},"additionalProperties":false,"type":"object","required":["messages"],"title":"ManiacChatRequest","description":"OpenAI-compatible chat completion request with Maniac extensions."},"Message":{"properties":{"role":{"type":"string","enum":["system","user","assistant","developer","tool"],"title":"Role","description":"Message role."},"content":{"anyOf":[{"type":"string"},{"items":{"oneOf":[{"$ref":"#/components/schemas/TextContentPart"},{"$ref":"#/components/schemas/ImageContentPart"},{"$ref":"#/components/schemas/InputAudioContentPart"},{"$ref":"#/components/schemas/FileContentPart"}],"discriminator":{"propertyName":"type","mapping":{"file":"#/components/schemas/FileContentPart","image_url":"#/components/schemas/ImageContentPart","input_audio":"#/components/schemas/InputAudioContentPart","text":"#/components/schemas/TextContentPart"}}},"type":"array"},{"type":"null"}],"title":"Content","description":"Message content (string or list of content parts)."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Optional name."},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls","description":"Tool calls (assistant message)."},"tool_call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Call Id","description":"Tool call ID (tool messages)."}},"additionalProperties":false,"type":"object","required":["role"],"title":"Message","description":"OpenAI-style chat message."},"TextContentPart":{"properties":{"type":{"type":"string","const":"text","title":"Type","description":"Content part type.","default":"text"},"text":{"type":"string","title":"Text","description":"Text content."}},"type":"object","required":["text"],"title":"TextContentPart","description":"Text content part in a message."},"ImageContentPart":{"properties":{"type":{"type":"string","const":"image_url","title":"Type","description":"Content part type.","default":"image_url"},"image_url":{"$ref":"#/components/schemas/ImageURL","description":"Image URL object with 'url' and optional 'detail'."}},"type":"object","required":["image_url"],"title":"ImageContentPart","description":"Image content part in a message."},"ImageURL":{"properties":{"url":{"type":"string","title":"Url","description":"Image URL (http(s) or data URL)."},"detail":{"title":"Detail","description":"Image detail hint; 'auto' lets the provider decide.","type":"string","enum":["auto","low","high"],"nullable":true}},"additionalProperties":true,"type":"object","required":["url"],"title":"ImageURL","description":"Image URL object inside an image_url content part.\n\nMirrors OpenAI's chat completions image content; ``detail`` is optional and\n``extra=\"allow\"`` keeps the door open for provider-specific extensions\n(OpenRouter occasionally adds routing hints here)."},"InputAudioContentPart":{"properties":{"type":{"type":"string","const":"input_audio","title":"Type","description":"Content part type.","default":"input_audio"},"input_audio":{"$ref":"#/components/schemas/InputAudio","description":"Audio payload."}},"type":"object","required":["input_audio"],"title":"InputAudioContentPart","description":"Audio content part in a user message (gpt-4o-audio family)."},"InputAudio":{"properties":{"data":{"type":"string","title":"Data","description":"Base64-encoded audio bytes."},"format":{"type":"string","enum":["wav","mp3"],"title":"Format","description":"Audio container format."}},"additionalProperties":false,"type":"object","required":["data","format"],"title":"InputAudio","description":"Audio payload inside an input_audio content part."},"FileContentPart":{"properties":{"type":{"type":"string","const":"file","title":"Type","description":"Content part type.","default":"file"},"file":{"$ref":"#/components/schemas/FileRef","description":"File reference (uploaded id or inline data)."}},"type":"object","required":["file"],"title":"FileContentPart","description":"File content part (e.g. PDFs) attached to a user message."},"FileRef":{"properties":{"file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Id","description":"Id of a previously uploaded file."},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename","description":"Display filename to send to the model (required with file_data)."},"file_data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Data","description":"Inline file payload as a data URL (e.g. data:application/pdf;base64,...)."}},"additionalProperties":true,"type":"object","title":"FileRef","description":"File reference inside a file content part.\n\nEither ``file_id`` (a previously uploaded file) or ``file_data`` (an inline\ndata URL, typically alongside ``filename``) must be set, matching OpenAI's\nfile input shape for chat completions."},"ToolCall":{"properties":{"id":{"type":"string","title":"Id","description":"Tool call id."},"type":{"type":"string","const":"function","title":"Type","description":"Tool call type.","default":"function"},"function":{"$ref":"#/components/schemas/FunctionCall","description":"Function call details."}},"type":"object","required":["id","function"],"title":"ToolCall","description":"A tool call emitted by the model."},"FunctionCall":{"properties":{"name":{"type":"string","title":"Name","description":"Function name."},"arguments":{"type":"string","title":"Arguments","description":"JSON-encoded arguments."}},"type":"object","required":["name","arguments"],"title":"FunctionCall","description":"Function call payload inside a tool call."},"ReasoningConfig":{"properties":{"effort":{"title":"Effort","description":"Reasoning effort level.","type":"string","enum":["none","minimal","low","medium","high","xhigh"],"nullable":true},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens","description":"Maximum tokens to allocate to reasoning. Used by providers that expose a thinking-token budget (Anthropic, Gemini thinking, some Alibaba Qwen models mapped to `thinking_budget`)."},"exclude":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exclude","description":"If true, the model still performs reasoning internally but the reasoning tokens are omitted from the response."},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled","description":"Explicitly enable or disable reasoning. When true, reasoning runs at provider-default settings unless `effort` or `max_tokens` is set."}},"additionalProperties":false,"type":"object","title":"ReasoningConfig","description":"Reasoning configuration for reasoning models.\n\nMatches OpenRouter's chat-completions reasoning schema. See\nhttps://openrouter.ai/docs/use-cases/reasoning-tokens for provider-specific\nsemantics (effort -> OpenAI/Grok, max_tokens -> Anthropic/Gemini/Qwen)."},"ResponseFormatText":{"properties":{"type":{"type":"string","const":"text","title":"Type","description":"Format type.","default":"text"}},"type":"object","title":"ResponseFormatText","description":"Plain text response format (default)."},"ResponseFormatJsonSchema":{"properties":{"type":{"type":"string","const":"json_schema","title":"Type","description":"Format type.","default":"json_schema"},"json_schema":{"$ref":"#/components/schemas/JsonSchemaConfig","description":"JSON schema configuration."}},"type":"object","required":["json_schema"],"title":"ResponseFormatJsonSchema","description":"Structured JSON output via a supplied schema."},"JsonSchemaConfig":{"properties":{"name":{"type":"string","title":"Name","description":"Schema name."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Schema description."},"schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Schema","description":"JSON Schema object."},"strict":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Strict","description":"Whether to enforce strict schema adherence."}},"type":"object","required":["name"],"title":"JsonSchemaConfig","description":"Configuration for json_schema response format."},"ResponseFormatJsonObject":{"properties":{"type":{"type":"string","const":"json_object","title":"Type","description":"Format type.","default":"json_object"}},"type":"object","title":"ResponseFormatJsonObject","description":"JSON object response format (legacy JSON mode)."},"StreamOptions":{"properties":{"include_usage":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Include Usage","description":"Include a final chunk with token usage statistics."}},"type":"object","title":"StreamOptions","description":"Options for streaming responses."},"ToolChoiceFunction":{"properties":{"type":{"type":"string","const":"function","title":"Type","description":"Tool choice type.","default":"function"},"function":{"$ref":"#/components/schemas/ToolChoiceFunctionName","description":"Function to call."}},"type":"object","required":["function"],"title":"ToolChoiceFunction","description":"Force the model to call a specific function."},"ToolChoiceFunctionName":{"properties":{"name":{"type":"string","title":"Name","description":"Function name."}},"type":"object","required":["name"],"title":"ToolChoiceFunctionName","description":"Specifies a function name to force-call."},"ToolDefinition":{"properties":{"type":{"type":"string","const":"function","title":"Type","description":"Tool type.","default":"function"},"function":{"$ref":"#/components/schemas/FunctionDefinition","description":"Function definition."}},"type":"object","required":["function"],"title":"ToolDefinition","description":"A tool the model may call."},"FunctionDefinition":{"properties":{"name":{"type":"string","title":"Name","description":"Function name."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description of what the function does."},"parameters":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Parameters","description":"JSON Schema for the function parameters."},"strict":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Strict","description":"Whether to enforce strict schema adherence."}},"type":"object","required":["name"],"title":"FunctionDefinition","description":"Function definition inside a tool."},"ImageConfig":{"properties":{"quality":{"title":"Quality","description":"Render quality.","type":"string","enum":["auto","low","medium","high","standard","hd"],"nullable":true},"size":{"title":"Size","description":"Output dimensions.","type":"string","enum":["auto","256x256","512x512","1024x1024","1024x1536","1024x1792","1536x1024","1792x1024"],"nullable":true},"background":{"title":"Background","description":"Background handling.","type":"string","enum":["auto","transparent","opaque"],"nullable":true},"output_format":{"title":"Output Format","description":"Encoded image format.","type":"string","enum":["png","jpeg","webp"],"nullable":true},"output_compression":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Compression","description":"Compression level (0-100) for lossy output formats."},"moderation":{"title":"Moderation","description":"Moderation strictness level.","type":"string","enum":["auto","low"],"nullable":true}},"additionalProperties":true,"type":"object","title":"ImageConfig","description":"Image output configuration (paired with ``modalities: [\"image\"]``).\n\nMirrors OpenAI's gpt-image / chat-image params and OpenRouter's\n``image_config`` passthrough."},"AudioOutputConfig":{"properties":{"voice":{"type":"string","enum":["alloy","ash","ballad","coral","echo","fable","nova","onyx","sage","shimmer","verse"],"title":"Voice","description":"Voice identifier for synthesized audio."},"format":{"type":"string","enum":["wav","mp3","flac","opus","pcm16","aac"],"title":"Format","description":"Audio container format for the response."}},"additionalProperties":true,"type":"object","required":["voice","format"],"title":"AudioOutputConfig","description":"Audio output configuration (paired with ``modalities: [\"audio\"]``)."},"PredictionContent":{"properties":{"type":{"type":"string","const":"content","title":"Type","description":"Prediction type.","default":"content"},"content":{"anyOf":[{"type":"string"},{"items":{"$ref":"#/components/schemas/TextContentPart"},"type":"array"}],"title":"Content","description":"Predicted content (string or list of text parts)."}},"additionalProperties":false,"type":"object","required":["content"],"title":"PredictionContent","description":"Predicted output content (OpenAI predicted outputs)."},"WebSearchOptions":{"properties":{"search_context_size":{"title":"Search Context Size","description":"How much context the search tool should pull in.","type":"string","enum":["low","medium","high"],"nullable":true},"user_location":{"anyOf":[{"$ref":"#/components/schemas/WebSearchApproximateLocation"},{"type":"null"}],"description":"Approximate user location."}},"additionalProperties":true,"type":"object","title":"WebSearchOptions","description":"Configuration for the built-in web search tool on supported models."},"WebSearchApproximateLocation":{"properties":{"type":{"type":"string","const":"approximate","title":"Type","description":"Location type.","default":"approximate"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country","description":"ISO country code."},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region","description":"State/region name."},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City","description":"City name."},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone","description":"IANA timezone."}},"additionalProperties":true,"type":"object","title":"WebSearchApproximateLocation","description":"Approximate user location used to bias web search results."},"TraceContext":{"properties":{"id":{"type":"string","title":"Id","description":"External trace identifier used to group requests."},"span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Span Id","description":"Optional span identifier within the trace."},"parent_span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Span Id","description":"Optional parent span identifier."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Optional trace name."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"Optional trace source, e.g. langchain."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional metadata associated with the trace."}},"additionalProperties":false,"type":"object","required":["id"],"title":"TraceContext"},"ChatRes":{"properties":{"id":{"type":"string","title":"Id","description":"Completion id."},"choices":{"items":{"$ref":"#/components/schemas/ChatResponseChoice-Output"},"type":"array","title":"Choices","description":"Response choices."},"created":{"type":"number","title":"Created","description":"Creation timestamp (unix)."},"model":{"type":"string","title":"Model","description":"Model used."},"object":{"type":"string","const":"chat.completion","title":"Object","description":"Object type.","default":"chat.completion"},"usage":{"anyOf":[{"$ref":"#/components/schemas/ChatResponseUsage"},{"type":"null"}],"description":"Token usage."},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider","description":"Upstream provider name, if available."},"container":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Container","description":"Container label used for routing, if any."}},"additionalProperties":false,"type":"object","required":["id","choices","created","model"],"title":"ChatRes"},"ChatResponseChoice-Output":{"properties":{"index":{"type":"number","title":"Index","description":"Choice index."},"message":{"$ref":"#/components/schemas/ChatResponseMessage-Output","description":"Assistant message."},"finish_reason":{"title":"Finish Reason","description":"Reason generation finished.","type":"string","enum":["stop","length","tool_calls","content_filter","error"],"nullable":true},"logprobs":{"anyOf":[{},{"type":"null"}],"title":"Logprobs","description":"Logprobs if requested."}},"additionalProperties":false,"type":"object","required":["index","message"],"title":"ChatResponseChoice","description":"Single choice in a chat completion response."},"ChatResponseMessage-Output":{"properties":{"role":{"type":"string","title":"Role","description":"Message role."},"content":{"anyOf":[{},{"type":"null"}],"title":"Content","description":"Message content."},"refusal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refusal","description":"Refusal text when the model declines to answer."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Optional name."},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls","description":"Tool calls."},"audio":{"anyOf":[{"$ref":"#/components/schemas/AudioResponse"},{"type":"null"}],"description":"Audio output when the assistant returns audio (modalities=['audio'])."},"images":{"anyOf":[{"items":{"$ref":"#/components/schemas/ImageContentPart"},"type":"array"},{"type":"null"}],"title":"Images","description":"Generated images (OpenRouter image-output models; modalities=['image'])."}},"additionalProperties":true,"type":"object","required":["role"],"title":"ChatResponseMessage","description":"Assistant message in a choice."},"AudioResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Audio response id."},"data":{"type":"string","title":"Data","description":"Base64-encoded audio bytes."},"expires_at":{"type":"integer","title":"Expires At","description":"Unix timestamp when the audio asset stops being retrievable."},"transcript":{"type":"string","title":"Transcript","description":"Transcript of the synthesized audio."}},"additionalProperties":true,"type":"object","required":["id","data","expires_at","transcript"],"title":"AudioResponse","description":"Audio output emitted on the assistant message (gpt-4o-audio family)."},"ChatResponseUsage":{"properties":{"prompt_tokens":{"type":"number","title":"Prompt Tokens","description":"Prompt tokens."},"completion_tokens":{"type":"number","title":"Completion Tokens","description":"Completion tokens."},"total_tokens":{"type":"number","title":"Total Tokens","description":"Total tokens."},"completion_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Completion Tokens Details"},"prompt_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Prompt Tokens Details"}},"additionalProperties":true,"type":"object","required":["prompt_tokens","completion_tokens","total_tokens"],"title":"ChatResponseUsage","description":"Token usage in a chat completion response."},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ManiacError","description":"Error payload."}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorResponse","description":"Response body for errors."},"ManiacError":{"properties":{"code":{"type":"string","title":"Code","description":"Machine-readable error code."},"message":{"type":"string","title":"Message","description":"Human-readable error message."},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details","description":"Additional error details."}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"ManiacError","description":"Standard Maniac API error envelope.\n\nThis matches the shape already used by v2 auth (`detail={\"error\": {...}}`)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/chat/completions":{"post":{"tags":["Chat"],"summary":"Create a chat completion","description":"Create a chat completion using the specified model.\n\nSupports both streaming and non-streaming responses and is compatible with\nOpenAI's chat completions API. Use a container slug (`maniac:<container>`)\nor an external slug (e.g. `openai/gpt-4o`). `/` and `:` are treated\nequivalently on input.","operationId":"chat_completions_create","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatReq"}}}},"responses":{"200":{"description":"Server-Sent Events stream for streaming responses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRes"}},"text/event-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"429":{"description":"Too Many Requests","headers":{"X-RateLimit-Limit":{"description":"Request limit per window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Not Implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Upstream Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get a chat completion

> Fetch a single chat completion by id within the authenticated project.

```json
{"openapi":"3.1.0","info":{"title":"Maniac Inference Gateway API","version":"1.0.0"},"tags":[{"name":"Chat","description":"Chat completion endpoints (OpenAI-compatible)."}],"servers":[{"url":"https://platform.maniac.ai","description":"The Maniac API"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"API key in Authorization header using Bearer <token>."}},"schemas":{"ChatResRelaxed-Output":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Completion id."},"choices":{"items":{"$ref":"#/components/schemas/RegisterOutputChoice"},"type":"array","title":"Choices"},"created":{"anyOf":[{},{"type":"null"}],"title":"Created","description":"Creation timestamp (unix seconds)."},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"Model slug used."},"object":{"type":"string","const":"chat.completion","title":"Object","description":"Object type.","default":"chat.completion"},"usage":{"anyOf":[{"$ref":"#/components/schemas/ChatResponseUsage"},{"type":"null"}],"description":"Token usage."},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider","description":"Upstream provider name, if available."},"container":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Container","description":"Container label used for routing, if any."},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id","description":"Model ID (uuid)."},"spend":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Spend","description":"Estimated spend."},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags","description":"Tags for this completion."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Metadata for this completion."},"trace":{"anyOf":[{"$ref":"#/components/schemas/TraceContext"},{"type":"null"}],"description":"Optional external trace/span context associated with this completion."}},"type":"object","required":["choices"],"title":"ChatResRelaxed"},"RegisterOutputChoice":{"properties":{"index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Index","description":"Choice index."},"message":{"$ref":"#/components/schemas/RegisterOutputMessage"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finish Reason","description":"Reason the generation finished."}},"additionalProperties":true,"type":"object","required":["message"],"title":"RegisterOutputChoice"},"RegisterOutputMessage":{"properties":{"role":{"type":"string","title":"Role","description":"Message role (system, user, assistant)."},"content":{"anyOf":[{"type":"string"},{"items":{},"type":"array"},{"type":"null"}],"title":"Content","description":"Message content (string or structured parts)."}},"additionalProperties":true,"type":"object","required":["role"],"title":"RegisterOutputMessage"},"ChatResponseUsage":{"properties":{"prompt_tokens":{"type":"number","title":"Prompt Tokens","description":"Prompt tokens."},"completion_tokens":{"type":"number","title":"Completion Tokens","description":"Completion tokens."},"total_tokens":{"type":"number","title":"Total Tokens","description":"Total tokens."},"completion_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Completion Tokens Details"},"prompt_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Prompt Tokens Details"}},"additionalProperties":true,"type":"object","required":["prompt_tokens","completion_tokens","total_tokens"],"title":"ChatResponseUsage","description":"Token usage in a chat completion response."},"TraceContext":{"properties":{"id":{"type":"string","title":"Id","description":"External trace identifier used to group requests."},"span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Span Id","description":"Optional span identifier within the trace."},"parent_span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Span Id","description":"Optional parent span identifier."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Optional trace name."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"Optional trace source, e.g. langchain."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional metadata associated with the trace."}},"additionalProperties":false,"type":"object","required":["id"],"title":"TraceContext"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ManiacError","description":"Error payload."}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorResponse","description":"Response body for errors."},"ManiacError":{"properties":{"code":{"type":"string","title":"Code","description":"Machine-readable error code."},"message":{"type":"string","title":"Message","description":"Human-readable error message."},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details","description":"Additional error details."}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"ManiacError","description":"Standard Maniac API error envelope.\n\nThis matches the shape already used by v2 auth (`detail={\"error\": {...}}`)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/chat/completions/{completion_id}":{"get":{"tags":["Chat"],"summary":"Get a chat completion","description":"Fetch a single chat completion by id within the authenticated project.","operationId":"chat_completions_retrieve","parameters":[{"name":"completion_id","in":"path","required":true,"schema":{"type":"string","title":"Completion Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResRelaxed-Output"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"429":{"description":"Too Many Requests","headers":{"X-RateLimit-Limit":{"description":"Request limit per window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Not Implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Upstream Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Register chat completion examples

> Register completed chat examples for evaluation and analytics.\
> \
> This endpoint accepts input/output pairs and stores them for later analysis,\
> while aggregating usage metrics for reporting.

```json
{"openapi":"3.1.0","info":{"title":"Maniac Inference Gateway API","version":"1.0.0"},"tags":[{"name":"Chat","description":"Chat completion endpoints (OpenAI-compatible)."}],"servers":[{"url":"https://platform.maniac.ai","description":"The Maniac API"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"API key in Authorization header using Bearer <token>."}},"schemas":{"RegisterReq":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Item"},"type":"array","title":"Items","description":"List of chat input/output examples."},"container":{"type":"string","title":"Container","description":"Container label to associate these examples with."}},"additionalProperties":false,"type":"object","required":["items","container"],"title":"RegisterChatCompletionsRequest","description":"Register completed chat examples for evaluation or analytics."},"Item":{"properties":{"input":{"$ref":"#/components/schemas/ChatReq"},"output":{"anyOf":[{"$ref":"#/components/schemas/ChatResRelaxed-Input"},{"type":"null"}],"description":"Chat completion output. Omit to register input-only examples."},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags","description":"Optional tags for this example."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional metadata for this example."}},"additionalProperties":false,"type":"object","required":["input"],"title":"Item"},"ChatReq":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages","description":"Conversation messages."},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"Model slug to use. Supports global slugs and container routes; `/` and `:` are treated equivalently on input."},"models":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Models","description":"Fallback models."},"frequency_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Frequency Penalty","description":"Frequency penalty."},"logit_bias":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Logit Bias","description":"Logit bias."},"logprobs":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Logprobs","description":"Include logprobs."},"top_logprobs":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top Logprobs","description":"Top logprobs."},"max_completion_tokens":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Completion Tokens","description":"Max completion tokens."},"max_tokens":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Tokens","description":"Max tokens."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Arbitrary key/value metadata to attach to the request."},"n":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N","description":"Number of chat completion choices to generate (OpenAI ``n``)."},"presence_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Presence Penalty","description":"Presence penalty."},"reasoning":{"anyOf":[{"$ref":"#/components/schemas/ReasoningConfig"},{"type":"null"}],"description":"Reasoning config."},"response_format":{"anyOf":[{"$ref":"#/components/schemas/ResponseFormatText"},{"$ref":"#/components/schemas/ResponseFormatJsonSchema"},{"$ref":"#/components/schemas/ResponseFormatJsonObject"},{"type":"null"}],"title":"Response Format","description":"Response format."},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed","description":"Random seed."},"service_tier":{"title":"Service Tier","description":"Service tier hint (auto/default/flex/scale/priority).","type":"string","enum":["auto","default","flex","scale","priority"],"nullable":true},"stop":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Stop","description":"Stop sequences."},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","description":"Stream response.","default":false},"stream_options":{"anyOf":[{"$ref":"#/components/schemas/StreamOptions"},{"type":"null"}],"description":"Stream options."},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature","description":"Temperature."},"tool_choice":{"anyOf":[{"type":"string","enum":["none","auto","required"]},{"$ref":"#/components/schemas/ToolChoiceFunction"},{"type":"null"}],"title":"Tool Choice","description":"Tool choice."},"tools":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolDefinition"},"type":"array"},{"type":"null"}],"title":"Tools","description":"Tools."},"parallel_tool_calls":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Parallel Tool Calls","description":"Whether the model may emit multiple tool calls in parallel."},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P","description":"Top p."},"top_k":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top K","description":"Top-k sampling (OpenRouter / Anthropic / vLLM)."},"min_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min P","description":"Min-p sampling cutoff (OpenRouter / vLLM)."},"top_a":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top A","description":"Top-a sampling cutoff (OpenRouter alternate sampler)."},"repetition_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Repetition Penalty","description":"Repetition penalty (OpenRouter / non-OpenAI providers)."},"image_config":{"anyOf":[{"$ref":"#/components/schemas/ImageConfig"},{"type":"null"}],"description":"Image output configuration when ``modalities`` includes 'image'."},"modalities":{"anyOf":[{"items":{"type":"string","enum":["text","image","audio"]},"type":"array"},{"type":"null"}],"title":"Modalities","description":"Output modalities to enable (text, image, audio)."},"audio":{"anyOf":[{"$ref":"#/components/schemas/AudioOutputConfig"},{"type":"null"}],"description":"Audio output configuration when ``modalities`` includes 'audio'."},"prediction":{"anyOf":[{"$ref":"#/components/schemas/PredictionContent"},{"type":"null"}],"description":"Predicted output content for faster generation."},"web_search_options":{"anyOf":[{"$ref":"#/components/schemas/WebSearchOptions"},{"type":"null"}],"description":"Web search tool configuration for supported models."},"transforms":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Transforms","description":"OpenRouter transform pipeline names (e.g. 'middle-out')."},"preset":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preset","description":"OpenRouter preset name (server-side stored param bundle)."},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Optional tags for tracking."},"store":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Store","description":"Whether to store the completion in the database.","default":true},"trace":{"anyOf":[{"$ref":"#/components/schemas/TraceContext"},{"type":"null"}],"description":"Optional external trace/span context used to group related requests across containers."}},"additionalProperties":false,"type":"object","required":["messages"],"title":"ManiacChatRequest","description":"OpenAI-compatible chat completion request with Maniac extensions."},"Message":{"properties":{"role":{"type":"string","enum":["system","user","assistant","developer","tool"],"title":"Role","description":"Message role."},"content":{"anyOf":[{"type":"string"},{"items":{"oneOf":[{"$ref":"#/components/schemas/TextContentPart"},{"$ref":"#/components/schemas/ImageContentPart"},{"$ref":"#/components/schemas/InputAudioContentPart"},{"$ref":"#/components/schemas/FileContentPart"}],"discriminator":{"propertyName":"type","mapping":{"file":"#/components/schemas/FileContentPart","image_url":"#/components/schemas/ImageContentPart","input_audio":"#/components/schemas/InputAudioContentPart","text":"#/components/schemas/TextContentPart"}}},"type":"array"},{"type":"null"}],"title":"Content","description":"Message content (string or list of content parts)."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Optional name."},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls","description":"Tool calls (assistant message)."},"tool_call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Call Id","description":"Tool call ID (tool messages)."}},"additionalProperties":false,"type":"object","required":["role"],"title":"Message","description":"OpenAI-style chat message."},"TextContentPart":{"properties":{"type":{"type":"string","const":"text","title":"Type","description":"Content part type.","default":"text"},"text":{"type":"string","title":"Text","description":"Text content."}},"type":"object","required":["text"],"title":"TextContentPart","description":"Text content part in a message."},"ImageContentPart":{"properties":{"type":{"type":"string","const":"image_url","title":"Type","description":"Content part type.","default":"image_url"},"image_url":{"$ref":"#/components/schemas/ImageURL","description":"Image URL object with 'url' and optional 'detail'."}},"type":"object","required":["image_url"],"title":"ImageContentPart","description":"Image content part in a message."},"ImageURL":{"properties":{"url":{"type":"string","title":"Url","description":"Image URL (http(s) or data URL)."},"detail":{"title":"Detail","description":"Image detail hint; 'auto' lets the provider decide.","type":"string","enum":["auto","low","high"],"nullable":true}},"additionalProperties":true,"type":"object","required":["url"],"title":"ImageURL","description":"Image URL object inside an image_url content part.\n\nMirrors OpenAI's chat completions image content; ``detail`` is optional and\n``extra=\"allow\"`` keeps the door open for provider-specific extensions\n(OpenRouter occasionally adds routing hints here)."},"InputAudioContentPart":{"properties":{"type":{"type":"string","const":"input_audio","title":"Type","description":"Content part type.","default":"input_audio"},"input_audio":{"$ref":"#/components/schemas/InputAudio","description":"Audio payload."}},"type":"object","required":["input_audio"],"title":"InputAudioContentPart","description":"Audio content part in a user message (gpt-4o-audio family)."},"InputAudio":{"properties":{"data":{"type":"string","title":"Data","description":"Base64-encoded audio bytes."},"format":{"type":"string","enum":["wav","mp3"],"title":"Format","description":"Audio container format."}},"additionalProperties":false,"type":"object","required":["data","format"],"title":"InputAudio","description":"Audio payload inside an input_audio content part."},"FileContentPart":{"properties":{"type":{"type":"string","const":"file","title":"Type","description":"Content part type.","default":"file"},"file":{"$ref":"#/components/schemas/FileRef","description":"File reference (uploaded id or inline data)."}},"type":"object","required":["file"],"title":"FileContentPart","description":"File content part (e.g. PDFs) attached to a user message."},"FileRef":{"properties":{"file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Id","description":"Id of a previously uploaded file."},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename","description":"Display filename to send to the model (required with file_data)."},"file_data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Data","description":"Inline file payload as a data URL (e.g. data:application/pdf;base64,...)."}},"additionalProperties":true,"type":"object","title":"FileRef","description":"File reference inside a file content part.\n\nEither ``file_id`` (a previously uploaded file) or ``file_data`` (an inline\ndata URL, typically alongside ``filename``) must be set, matching OpenAI's\nfile input shape for chat completions."},"ToolCall":{"properties":{"id":{"type":"string","title":"Id","description":"Tool call id."},"type":{"type":"string","const":"function","title":"Type","description":"Tool call type.","default":"function"},"function":{"$ref":"#/components/schemas/FunctionCall","description":"Function call details."}},"type":"object","required":["id","function"],"title":"ToolCall","description":"A tool call emitted by the model."},"FunctionCall":{"properties":{"name":{"type":"string","title":"Name","description":"Function name."},"arguments":{"type":"string","title":"Arguments","description":"JSON-encoded arguments."}},"type":"object","required":["name","arguments"],"title":"FunctionCall","description":"Function call payload inside a tool call."},"ReasoningConfig":{"properties":{"effort":{"title":"Effort","description":"Reasoning effort level.","type":"string","enum":["none","minimal","low","medium","high","xhigh"],"nullable":true},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens","description":"Maximum tokens to allocate to reasoning. Used by providers that expose a thinking-token budget (Anthropic, Gemini thinking, some Alibaba Qwen models mapped to `thinking_budget`)."},"exclude":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exclude","description":"If true, the model still performs reasoning internally but the reasoning tokens are omitted from the response."},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled","description":"Explicitly enable or disable reasoning. When true, reasoning runs at provider-default settings unless `effort` or `max_tokens` is set."}},"additionalProperties":false,"type":"object","title":"ReasoningConfig","description":"Reasoning configuration for reasoning models.\n\nMatches OpenRouter's chat-completions reasoning schema. See\nhttps://openrouter.ai/docs/use-cases/reasoning-tokens for provider-specific\nsemantics (effort -> OpenAI/Grok, max_tokens -> Anthropic/Gemini/Qwen)."},"ResponseFormatText":{"properties":{"type":{"type":"string","const":"text","title":"Type","description":"Format type.","default":"text"}},"type":"object","title":"ResponseFormatText","description":"Plain text response format (default)."},"ResponseFormatJsonSchema":{"properties":{"type":{"type":"string","const":"json_schema","title":"Type","description":"Format type.","default":"json_schema"},"json_schema":{"$ref":"#/components/schemas/JsonSchemaConfig","description":"JSON schema configuration."}},"type":"object","required":["json_schema"],"title":"ResponseFormatJsonSchema","description":"Structured JSON output via a supplied schema."},"JsonSchemaConfig":{"properties":{"name":{"type":"string","title":"Name","description":"Schema name."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Schema description."},"schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Schema","description":"JSON Schema object."},"strict":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Strict","description":"Whether to enforce strict schema adherence."}},"type":"object","required":["name"],"title":"JsonSchemaConfig","description":"Configuration for json_schema response format."},"ResponseFormatJsonObject":{"properties":{"type":{"type":"string","const":"json_object","title":"Type","description":"Format type.","default":"json_object"}},"type":"object","title":"ResponseFormatJsonObject","description":"JSON object response format (legacy JSON mode)."},"StreamOptions":{"properties":{"include_usage":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Include Usage","description":"Include a final chunk with token usage statistics."}},"type":"object","title":"StreamOptions","description":"Options for streaming responses."},"ToolChoiceFunction":{"properties":{"type":{"type":"string","const":"function","title":"Type","description":"Tool choice type.","default":"function"},"function":{"$ref":"#/components/schemas/ToolChoiceFunctionName","description":"Function to call."}},"type":"object","required":["function"],"title":"ToolChoiceFunction","description":"Force the model to call a specific function."},"ToolChoiceFunctionName":{"properties":{"name":{"type":"string","title":"Name","description":"Function name."}},"type":"object","required":["name"],"title":"ToolChoiceFunctionName","description":"Specifies a function name to force-call."},"ToolDefinition":{"properties":{"type":{"type":"string","const":"function","title":"Type","description":"Tool type.","default":"function"},"function":{"$ref":"#/components/schemas/FunctionDefinition","description":"Function definition."}},"type":"object","required":["function"],"title":"ToolDefinition","description":"A tool the model may call."},"FunctionDefinition":{"properties":{"name":{"type":"string","title":"Name","description":"Function name."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description of what the function does."},"parameters":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Parameters","description":"JSON Schema for the function parameters."},"strict":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Strict","description":"Whether to enforce strict schema adherence."}},"type":"object","required":["name"],"title":"FunctionDefinition","description":"Function definition inside a tool."},"ImageConfig":{"properties":{"quality":{"title":"Quality","description":"Render quality.","type":"string","enum":["auto","low","medium","high","standard","hd"],"nullable":true},"size":{"title":"Size","description":"Output dimensions.","type":"string","enum":["auto","256x256","512x512","1024x1024","1024x1536","1024x1792","1536x1024","1792x1024"],"nullable":true},"background":{"title":"Background","description":"Background handling.","type":"string","enum":["auto","transparent","opaque"],"nullable":true},"output_format":{"title":"Output Format","description":"Encoded image format.","type":"string","enum":["png","jpeg","webp"],"nullable":true},"output_compression":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Compression","description":"Compression level (0-100) for lossy output formats."},"moderation":{"title":"Moderation","description":"Moderation strictness level.","type":"string","enum":["auto","low"],"nullable":true}},"additionalProperties":true,"type":"object","title":"ImageConfig","description":"Image output configuration (paired with ``modalities: [\"image\"]``).\n\nMirrors OpenAI's gpt-image / chat-image params and OpenRouter's\n``image_config`` passthrough."},"AudioOutputConfig":{"properties":{"voice":{"type":"string","enum":["alloy","ash","ballad","coral","echo","fable","nova","onyx","sage","shimmer","verse"],"title":"Voice","description":"Voice identifier for synthesized audio."},"format":{"type":"string","enum":["wav","mp3","flac","opus","pcm16","aac"],"title":"Format","description":"Audio container format for the response."}},"additionalProperties":true,"type":"object","required":["voice","format"],"title":"AudioOutputConfig","description":"Audio output configuration (paired with ``modalities: [\"audio\"]``)."},"PredictionContent":{"properties":{"type":{"type":"string","const":"content","title":"Type","description":"Prediction type.","default":"content"},"content":{"anyOf":[{"type":"string"},{"items":{"$ref":"#/components/schemas/TextContentPart"},"type":"array"}],"title":"Content","description":"Predicted content (string or list of text parts)."}},"additionalProperties":false,"type":"object","required":["content"],"title":"PredictionContent","description":"Predicted output content (OpenAI predicted outputs)."},"WebSearchOptions":{"properties":{"search_context_size":{"title":"Search Context Size","description":"How much context the search tool should pull in.","type":"string","enum":["low","medium","high"],"nullable":true},"user_location":{"anyOf":[{"$ref":"#/components/schemas/WebSearchApproximateLocation"},{"type":"null"}],"description":"Approximate user location."}},"additionalProperties":true,"type":"object","title":"WebSearchOptions","description":"Configuration for the built-in web search tool on supported models."},"WebSearchApproximateLocation":{"properties":{"type":{"type":"string","const":"approximate","title":"Type","description":"Location type.","default":"approximate"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country","description":"ISO country code."},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region","description":"State/region name."},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City","description":"City name."},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone","description":"IANA timezone."}},"additionalProperties":true,"type":"object","title":"WebSearchApproximateLocation","description":"Approximate user location used to bias web search results."},"TraceContext":{"properties":{"id":{"type":"string","title":"Id","description":"External trace identifier used to group requests."},"span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Span Id","description":"Optional span identifier within the trace."},"parent_span_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Span Id","description":"Optional parent span identifier."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Optional trace name."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"Optional trace source, e.g. langchain."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional metadata associated with the trace."}},"additionalProperties":false,"type":"object","required":["id"],"title":"TraceContext"},"ChatResRelaxed-Input":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Completion id."},"choices":{"items":{"$ref":"#/components/schemas/RegisterOutputChoice"},"type":"array","title":"Choices"},"created":{"anyOf":[{},{"type":"null"}],"title":"Created","description":"Creation timestamp (unix seconds)."},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"Model slug used."},"object":{"type":"string","const":"chat.completion","title":"Object","description":"Object type.","default":"chat.completion"},"usage":{"anyOf":[{"$ref":"#/components/schemas/ChatResponseUsage"},{"type":"null"}],"description":"Token usage."},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider","description":"Upstream provider name, if available."},"container":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Container","description":"Container label used for routing, if any."},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id","description":"Model ID (uuid)."},"spend":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Spend","description":"Estimated spend."},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags","description":"Tags for this completion."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Metadata for this completion."},"trace":{"anyOf":[{"$ref":"#/components/schemas/TraceContext"},{"type":"null"}],"description":"Optional external trace/span context associated with this completion."}},"type":"object","required":["choices"],"title":"ChatResRelaxed"},"RegisterOutputChoice":{"properties":{"index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Index","description":"Choice index."},"message":{"$ref":"#/components/schemas/RegisterOutputMessage"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finish Reason","description":"Reason the generation finished."}},"additionalProperties":true,"type":"object","required":["message"],"title":"RegisterOutputChoice"},"RegisterOutputMessage":{"properties":{"role":{"type":"string","title":"Role","description":"Message role (system, user, assistant)."},"content":{"anyOf":[{"type":"string"},{"items":{},"type":"array"},{"type":"null"}],"title":"Content","description":"Message content (string or structured parts)."}},"additionalProperties":true,"type":"object","required":["role"],"title":"RegisterOutputMessage"},"ChatResponseUsage":{"properties":{"prompt_tokens":{"type":"number","title":"Prompt Tokens","description":"Prompt tokens."},"completion_tokens":{"type":"number","title":"Completion Tokens","description":"Completion tokens."},"total_tokens":{"type":"number","title":"Total Tokens","description":"Total tokens."},"completion_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Completion Tokens Details"},"prompt_tokens_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Prompt Tokens Details"}},"additionalProperties":true,"type":"object","required":["prompt_tokens","completion_tokens","total_tokens"],"title":"ChatResponseUsage","description":"Token usage in a chat completion response."},"RegisterRes":{"properties":{"ok":{"type":"boolean","title":"Ok","description":"Whether the register operation succeeded."},"container":{"type":"string","title":"Container","description":"Container label used for registration."},"summary":{"additionalProperties":true,"type":"object","title":"Summary","description":"Summary of inserted and skipped items."},"errors":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Errors","description":"Up to 200 validation or upsert errors."}},"additionalProperties":false,"type":"object","required":["ok","container","summary","errors"],"title":"RegisterChatCompletionsResponse"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ManiacError","description":"Error payload."}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorResponse","description":"Response body for errors."},"ManiacError":{"properties":{"code":{"type":"string","title":"Code","description":"Machine-readable error code."},"message":{"type":"string","title":"Message","description":"Human-readable error message."},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details","description":"Additional error details."}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"ManiacError","description":"Standard Maniac API error envelope.\n\nThis matches the shape already used by v2 auth (`detail={\"error\": {...}}`)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/chat/completions/register":{"post":{"tags":["Chat"],"summary":"Register chat completion examples","description":"Register completed chat examples for evaluation and analytics.\n\nThis endpoint accepts input/output pairs and stores them for later analysis,\nwhile aggregating usage metrics for reporting.","operationId":"chat_completions_register","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterReq"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRes"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"429":{"description":"Too Many Requests","headers":{"X-RateLimit-Limit":{"description":"Request limit per window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Not Implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Upstream Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.maniac.ai/api-reference/chat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
