### Chat completion response example Source: https://mintrouter.ai/api-docs Example response from the /v1/chat/completions endpoint with status 200. Shows the chat completion object with choices and token usage. ```json { "id": "chatcmpl-abc123", "object": "chat.completion", "model": "claude-sonnet-4-6", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 } } ``` -------------------------------- ### GET /v1/models Source: https://mintrouter.ai/api-docs Lists the model ids available to the user's key, including context window and architecture details. ```APIDOC ## GET /v1/models ### Description List the model ids available to your key. Each entry includes context_length (the effective context window on MintRouter, in tokens), max_completion_tokens and, when known, an OpenRouter-style architecture object (input_modalities / output_modalities / modality); use context_length to configure the context window of your coding agent. ### Method GET ### Endpoint https://api.mintrouter.ai/v1/models ### Authentication Required - Bearer Token (Authorization: Bearer header) ### Headers - **accept** (string) - Optional - application/json ### Response #### Success Response (200) - **id** (string) - Model id - **context_length** (integer) - Effective context window on MintRouter, in tokens - **max_completion_tokens** (integer) - Maximum completion tokens - **architecture** (object) - OpenRouter-style architecture object with input_modalities, output_modalities, and modality (when known) ``` -------------------------------- ### POST /v1/chat/completions Source: https://mintrouter.ai/api-docs Creates a chat completion with support for streaming tokens via server-sent events. ```APIDOC ## POST /v1/chat/completions ### Description Create a chat completion; set "stream": true to stream tokens as they are generated. ### Method POST ### Endpoint https://api.mintrouter.ai/v1/chat/completions ### Authentication Required - Bearer Token (Authorization: Bearer header) ### Request Body - **messages** (array) - Required - List of messages forming the conversation so far. - **model** (string) - Required - Model id to route the request to. - **max_tokens** (integer) - Optional - Maximum number of tokens to generate. - **stream** (boolean) - Optional - Set to true to stream the response as server-sent events. - **temperature** (number) - Optional - Sampling temperature; higher values produce more random output. ### Request Example ``` curl https://api.mintrouter.ai/v1/chat/completions \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \ --data '{ "model": "claude-sonnet-4-6", "messages": [ { "role": "user", "content": "Hello!" } ] }' ``` ### Response #### Success Response (200) - **id** (string) - Completion ID - **object** (string) - Object type (chat.completion) - **model** (string) - Model used - **choices** (array) - List of completion choices - **usage** (object) - Token usage details #### Response Example ``` { "id": "chatcmpl-abc123", "object": "chat.completion", "model": "claude-sonnet-4-6", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 } } ``` ``` -------------------------------- ### Create a chat completion with curl Source: https://mintrouter.ai/api-docs Send a chat completion request to the OpenAI-compatible /v1/chat/completions endpoint. Requires an Authorization: Bearer header with YOUR_SECRET_TOKEN. The request body includes the model and messages array. ```shell curl https://api.mintrouter.ai/v1/chat/completions \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \ --data '{ "model": "claude-sonnet-4-6", "messages": [ { "role": "user", "content": "Hello!" } ] }' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.