curl --request POST \
--url https://api.mixroute.ai/v1/chat/completions \
--header 'Authorization: Bearer sk-xxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Briefly introduce artificial intelligence"}
],
"temperature": 0.7
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxxxxxx",
base_url="https://api.mixroute.ai/v1"
)
response = client.chat.completions.create(
model="gpt-5.5",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Briefly introduce artificial intelligence"}
],
temperature=0.7
)
print(response.choices[0].message.content)
const OpenAI = require('openai');
const client = new OpenAI({
apiKey: 'sk-xxxxxxxxxx',
baseURL: 'https://api.mixroute.ai/v1'
});
const response = await client.chat.completions.create({
model: 'gpt-5.5',
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'Briefly introduce artificial intelligence' }
],
temperature: 0.7
});
console.log(response.choices[0].message.content);
<?php
$client = new GuzzleHttp\Client();
$response = $client->post('https://api.mixroute.ai/v1/chat/completions', [
'headers' => [
'Authorization' => 'Bearer sk-xxxxxxxxxx',
'Content-Type' => 'application/json',
],
'json' => [
'model' => 'gpt-5.5',
'messages' => [
['role' => 'system', 'content' => 'You are a helpful assistant'],
['role' => 'user', 'content' => 'Briefly introduce artificial intelligence']
],
'temperature' => 0.7
]
]);
echo $response->getBody();
package main
import (
"context"
"fmt"
openai "github.com/sashabaranov/go-openai"
)
func main() {
config := openai.DefaultConfig("sk-xxxxxxxxxx")
config.BaseURL = "https://api.mixroute.ai/v1"
client := openai.NewClientWithConfig(config)
resp, _ := client.CreateChatCompletion(
context.Background(),
openai.ChatCompletionRequest{
Model: "gpt-5.5",
Messages: []openai.ChatCompletionMessage{
{Role: "system", Content: "You are a helpful assistant"},
{Role: "user", Content: "Briefly introduce artificial intelligence"},
},
},
)
fmt.Println(resp.Choices[0].Message.Content)
}
import com.theokanning.openai.OpenAiService;
import com.theokanning.openai.completion.chat.*;
OpenAiService service = new OpenAiService("sk-xxxxxxxxxx");
ChatCompletionRequest request = ChatCompletionRequest.builder()
.model("gpt-5.5")
.messages(Arrays.asList(
new ChatMessage("system", "You are a helpful assistant"),
new ChatMessage("user", "Briefly introduce artificial intelligence")
))
.temperature(0.7)
.build();
ChatCompletionResult result = service.createChatCompletion(request);
System.out.println(result.getChoices().get(0).getMessage().getContent());
require 'openai'
client = OpenAI::Client.new(
access_token: 'sk-xxxxxxxxxx',
uri_base: 'https://api.mixroute.ai/v1'
)
response = client.chat(
parameters: {
model: 'gpt-5.5',
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'Briefly introduce artificial intelligence' }
],
temperature: 0.7
}
)
puts response.dig('choices', 0, 'message', 'content')
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-5.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Artificial intelligence is a new technical science that researches and develops theories, methods, techniques, and application systems for simulating, extending, and expanding human intelligence..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 100,
"total_tokens": 125
}
}
Text Series
Chat Completions (OpenAI)
Universal text chat API supporting OpenAI-compatible LLMs
POST
/
v1
/
chat
/
completions
curl --request POST \
--url https://api.mixroute.ai/v1/chat/completions \
--header 'Authorization: Bearer sk-xxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Briefly introduce artificial intelligence"}
],
"temperature": 0.7
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxxxxxx",
base_url="https://api.mixroute.ai/v1"
)
response = client.chat.completions.create(
model="gpt-5.5",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Briefly introduce artificial intelligence"}
],
temperature=0.7
)
print(response.choices[0].message.content)
const OpenAI = require('openai');
const client = new OpenAI({
apiKey: 'sk-xxxxxxxxxx',
baseURL: 'https://api.mixroute.ai/v1'
});
const response = await client.chat.completions.create({
model: 'gpt-5.5',
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'Briefly introduce artificial intelligence' }
],
temperature: 0.7
});
console.log(response.choices[0].message.content);
<?php
$client = new GuzzleHttp\Client();
$response = $client->post('https://api.mixroute.ai/v1/chat/completions', [
'headers' => [
'Authorization' => 'Bearer sk-xxxxxxxxxx',
'Content-Type' => 'application/json',
],
'json' => [
'model' => 'gpt-5.5',
'messages' => [
['role' => 'system', 'content' => 'You are a helpful assistant'],
['role' => 'user', 'content' => 'Briefly introduce artificial intelligence']
],
'temperature' => 0.7
]
]);
echo $response->getBody();
package main
import (
"context"
"fmt"
openai "github.com/sashabaranov/go-openai"
)
func main() {
config := openai.DefaultConfig("sk-xxxxxxxxxx")
config.BaseURL = "https://api.mixroute.ai/v1"
client := openai.NewClientWithConfig(config)
resp, _ := client.CreateChatCompletion(
context.Background(),
openai.ChatCompletionRequest{
Model: "gpt-5.5",
Messages: []openai.ChatCompletionMessage{
{Role: "system", Content: "You are a helpful assistant"},
{Role: "user", Content: "Briefly introduce artificial intelligence"},
},
},
)
fmt.Println(resp.Choices[0].Message.Content)
}
import com.theokanning.openai.OpenAiService;
import com.theokanning.openai.completion.chat.*;
OpenAiService service = new OpenAiService("sk-xxxxxxxxxx");
ChatCompletionRequest request = ChatCompletionRequest.builder()
.model("gpt-5.5")
.messages(Arrays.asList(
new ChatMessage("system", "You are a helpful assistant"),
new ChatMessage("user", "Briefly introduce artificial intelligence")
))
.temperature(0.7)
.build();
ChatCompletionResult result = service.createChatCompletion(request);
System.out.println(result.getChoices().get(0).getMessage().getContent());
require 'openai'
client = OpenAI::Client.new(
access_token: 'sk-xxxxxxxxxx',
uri_base: 'https://api.mixroute.ai/v1'
)
response = client.chat(
parameters: {
model: 'gpt-5.5',
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'Briefly introduce artificial intelligence' }
],
temperature: 0.7
}
)
puts response.dig('choices', 0, 'message', 'content')
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-5.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Artificial intelligence is a new technical science that researches and develops theories, methods, techniques, and application systems for simulating, extending, and expanding human intelligence..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 100,
"total_tokens": 125
}
}
Introduction
Universal text chat interface supporting OpenAI-compatible large language models. Through a unified API, you can access OpenAI, Claude, DeepSeek, Grok, Qwen, and many other mainstream models via MixRouteAuthentication
Bearer Token, e.g.,Bearer sk-xxxxxxxxxx
Request Parameters
string
required
Model identifier, corresponding to the Model Marketplace.
MixRoute supports multiple models. See the complete list at Model Marketplace.
array
required
Array of conversation messages, each containing
role (user/system/assistant) and contentnumber
Randomness control, 0-2. Higher values produce more random responses
boolean
Enable streaming output, returns SSE format chunked data
integer
Maximum tokens to generate, controls response length
object
Output format, supports
text or json_object / json_schemanumber
Nucleus sampling parameter, 0-1, alternative to temperature. Lower values make sampling more conservative
number
Frequency penalty, -2 to 2. Positive values reduce repetition of frequent tokens
number
Presence penalty, -2 to 2. Positive values encourage discussing new topics
string | array
Stop sequences, generation stops when specified strings are encountered
integer
Random seed. Same seed makes results more consistent
string
End-user identifier for monitoring and rate-limiting
integer
Number of response candidates per prompt, defaults to 1
object
Token bias, maps token IDs to bias values (-100 to 100)
array
Tools definition list, each tool must include
type and functionstring
Tool selection strategy:
"auto" / "none" / "required", or specify a tool nameBasic Examples
- Non-Streaming Request
- Streaming Request (SSE)
- Python Example
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "gpt-5.5",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Please briefly introduce artificial intelligence"}
],
"temperature": 0.7
}'
curl -N -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "doubao-seed-1-8-251228",
"stream": true,
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Please briefly introduce artificial intelligence"}
]
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxxxxxx",
base_url="https://api.mixroute.ai/v1"
)
# Non-streaming
completion = client.chat.completions.create(
model="gpt-5.5",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Please briefly introduce artificial intelligence"}
],
temperature=0.7
)
print(completion.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="doubao-seed-1-8-251228",
messages=[
{"role": "user", "content": "Please briefly introduce artificial intelligence"}
],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
Advanced Features
- Tool Calling
- Structured Output
- Thinking Capability
- Qwen Extended
- Web Search
- GPT File Input
- Grok Reasoning
Supports OpenAI-compatible tool calling format:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "gpt-5.5",
"messages": [
{"role": "user", "content": "What is the weather in Shanghai?"}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather information by city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"}
},
"required": ["city"]
}
}
}
],
"tool_choice": "auto"
}'
Use JSON Schema to constrain model output format:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "gpt-5.5",
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "Answer",
"schema": {
"type": "object",
"properties": {
"summary": {"type": "string"}
},
"required": ["summary"]
}
}
},
"messages": [
{"role": "user", "content": "Return a JSON with a summary field"}
]
}'
- DeepSeek
- Qwen
- GPT-5.6
- Gemini
DeepSeek series supports deep thinking capability:Response will include
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "deepseek-v4-pro",
"messages": [
{"role": "user", "content": "Analyze this math problem: if x^2 + 2x - 3 = 0, find x"}
],
"temperature": 0.6
}'
reasoning_content field showing the thinking process.Qwen series supports thinking capability:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "qwen3.7-max",
"messages": [
{"role": "user", "content": "Analyze the development trends of artificial intelligence"}
],
"enable_thinking": true
}'
GPT-5.6 series (
gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna) supports advanced reasoning configuration:reasoning.mode— Execution mode:"standard"(default) or"pro". Pro Mode performs additional model work to improve reliability on difficult tasksreasoning.effort— Reasoning intensity:none/low/medium/high/xhigh/max(maxis a new level)
curl https://api.mixroute.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk" \
-d '{
"model": "gpt-5.6-luna",
"reasoning": {
"mode": "pro",
"effort":"max"
},
"input": "Analyze the potential risks of this database migration plan."
}'
Gemini 2.0 Flash Thinking supports thinking capability:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "gemini-2.0-flash-thinking-exp",
"messages": [
{"role": "user", "content": "Explain the basic principles of quantum computing"}
]
}'
Qwen supports additional extended parameters:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "qwen3.7-max",
"messages": [
{"role": "user", "content": "Hello"}
],
"enable_search": true,
"search_options": {
"search_strategy": "standard",
"forced_search": false
}
}'
| Parameter | Description |
|---|---|
enable_search | Enable web search |
search_options.search_strategy | Search strategy: standard/pro |
search_options.forced_search | Force search |
- Claude Search
- Grok Search
Claude models support web search functionality:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "claude-sonnet-5",
"messages": [
{"role": "user", "content": "What are today major news?"}
],
"tools": [
{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 5
}
]
}'
Grok models support real-time web search:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "grok-3",
"messages": [
{"role": "user", "content": "What are the latest tech news?"}
],
"search_parameters": {
"mode": "auto",
"return_citations": true
}
}'
GPT models support direct file content processing:Supported file types include PDF, Word, Excel, images, etc.
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Please analyze the content of this document"},
{
"type": "file",
"file": {
"url": "https://example.com/document.pdf"
}
}
]
}
]
}'
Model file processing capabilities vary between models, please choose a model that supports the file types you need.
Grok models support enhanced reasoning capability:
curl -X POST "https://api.mixroute.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-d '{
"model": "grok-3-mini",
"messages": [
{"role": "user", "content": "Analyze this logic problem: If all A are B, and all B are C, then..."}
],
"reasoning_effort": "high"
}'
| reasoning_effort | Description |
|---|---|
low | Quick response, basic reasoning |
medium | Balanced mode |
high | Deep reasoning, more accurate |
Response Format
- Non-Streaming Response
- Streaming Response
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-5.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Response content..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 100,
"total_tokens": 125
}
}
Streaming responses use Server-Sent Events (SSE) format:Each chunk contains incremental content, ending with
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1234567890,"model":"gpt-5.5","choices":[{"index":0,"delta":{"role":"assistant","content":"Hello"},"finish_reason":null}]}
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1234567890,"model":"gpt-5.5","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1234567890,"model":"gpt-5.5","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
[DONE].Error Handling
| Error Type | Trigger Scenario |
|---|---|
| AuthenticationError | Invalid API key or unauthorized |
| NotFoundError | Model does not exist or is not supported |
| APIConnectionError | Network interruption or server not responding |
| RateLimitError | Request rate limit exceeded |
curl --request POST \
--url https://api.mixroute.ai/v1/chat/completions \
--header 'Authorization: Bearer sk-xxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Briefly introduce artificial intelligence"}
],
"temperature": 0.7
}'
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxxxxxx",
base_url="https://api.mixroute.ai/v1"
)
response = client.chat.completions.create(
model="gpt-5.5",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Briefly introduce artificial intelligence"}
],
temperature=0.7
)
print(response.choices[0].message.content)
const OpenAI = require('openai');
const client = new OpenAI({
apiKey: 'sk-xxxxxxxxxx',
baseURL: 'https://api.mixroute.ai/v1'
});
const response = await client.chat.completions.create({
model: 'gpt-5.5',
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'Briefly introduce artificial intelligence' }
],
temperature: 0.7
});
console.log(response.choices[0].message.content);
<?php
$client = new GuzzleHttp\Client();
$response = $client->post('https://api.mixroute.ai/v1/chat/completions', [
'headers' => [
'Authorization' => 'Bearer sk-xxxxxxxxxx',
'Content-Type' => 'application/json',
],
'json' => [
'model' => 'gpt-5.5',
'messages' => [
['role' => 'system', 'content' => 'You are a helpful assistant'],
['role' => 'user', 'content' => 'Briefly introduce artificial intelligence']
],
'temperature' => 0.7
]
]);
echo $response->getBody();
package main
import (
"context"
"fmt"
openai "github.com/sashabaranov/go-openai"
)
func main() {
config := openai.DefaultConfig("sk-xxxxxxxxxx")
config.BaseURL = "https://api.mixroute.ai/v1"
client := openai.NewClientWithConfig(config)
resp, _ := client.CreateChatCompletion(
context.Background(),
openai.ChatCompletionRequest{
Model: "gpt-5.5",
Messages: []openai.ChatCompletionMessage{
{Role: "system", Content: "You are a helpful assistant"},
{Role: "user", Content: "Briefly introduce artificial intelligence"},
},
},
)
fmt.Println(resp.Choices[0].Message.Content)
}
import com.theokanning.openai.OpenAiService;
import com.theokanning.openai.completion.chat.*;
OpenAiService service = new OpenAiService("sk-xxxxxxxxxx");
ChatCompletionRequest request = ChatCompletionRequest.builder()
.model("gpt-5.5")
.messages(Arrays.asList(
new ChatMessage("system", "You are a helpful assistant"),
new ChatMessage("user", "Briefly introduce artificial intelligence")
))
.temperature(0.7)
.build();
ChatCompletionResult result = service.createChatCompletion(request);
System.out.println(result.getChoices().get(0).getMessage().getContent());
require 'openai'
client = OpenAI::Client.new(
access_token: 'sk-xxxxxxxxxx',
uri_base: 'https://api.mixroute.ai/v1'
)
response = client.chat(
parameters: {
model: 'gpt-5.5',
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'Briefly introduce artificial intelligence' }
],
temperature: 0.7
}
)
puts response.dig('choices', 0, 'message', 'content')
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-5.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Artificial intelligence is a new technical science that researches and develops theories, methods, techniques, and application systems for simulating, extending, and expanding human intelligence..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 100,
"total_tokens": 125
}
}
⌘I