API DocsAI Model APIsChatOpenAI

ChatCompletions Format

Create model responses based on conversation history. Supports streaming and non-streaming responses.

ChatCompletions Format

Create model responses based on conversation history. Supports streaming and non-streaming responses.

Compatible with the OpenAI Chat Completions API.

Base URL

  • https://autorouter.top — Production

Authentication

BearerAuth: http (bearer) Authenticate using a Bearer Token. Format: Authorization: Bearer sk-xxxxxx

Endpoints

POST /v1/chat/completions

Chat Completions Format

Create model responses based on conversation history. Supports streaming and non-streaming responses.

Compatible with the OpenAI Chat Completions API.

Request Body

Content-Type: application/json

Example:

{
  "model": "gpt-5.4-nano",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}

Properties:

NameTypeRequiredDescription
modelstringYesModel ID
messagesarrayYesList of conversation messages
temperaturenumberNoSampling temperature
top_pnumberNoNucleus sampling parameter
nintegerNoNumber of completions to generate
streambooleanNoWhether to stream the response
stream_optionsobjectNo-
stopstringNoStop sequences. Can also be an array of strings.
max_tokensintegerNoMaximum number of tokens to generate
max_completion_tokensintegerNoMaximum completion tokens
presence_penaltynumberNo-
frequency_penaltynumberNo-
logit_biasobjectNo-
userstringNo-
toolsarrayNo-
tool_choicestringNoTool selection mode. Can also be an object to specify a particular function.
response_formatobjectNo-
seedintegerNo-
reasoning_effortstringNoReasoning effort (for models that support reasoning)
modalitiesarrayNo-
audioobjectNo-

Responses

200: Successfully created response

Content-Type: application/json

400: Bad request / invalid parameters

Content-Type: application/json

429: Rate limit exceeded

Content-Type: application/json

Request Example

curl -X POST "https://autorouter.top/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-5.4-nano",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}'

Response Examples

{
  "id": "string",
  "object": "chat.completion",
  "created": 0,
  "model": "string",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "system",
        "content": "string",
        "name": "string",
        "tool_calls": [
          {
            "id": "string",
            "type": "string",
            "function": {
              "name": "string",
              "arguments": "string"
            }
          }
        ],
        "tool_call_id": "string",
        "reasoning_content": "string"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 0,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0
    }
  },
  "system_fingerprint": "string"
}

On this page