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
}
}
テキストシリーズ
Chat Completions(OpenAI)
OpenAI互換LLMに対応した汎用テキストチャットAPI
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
}
}
はじめに
OpenAI互換の大規模言語モデルをサポートする汎用テキストチャットインターフェースです。統一されたAPIを通じて、MixRoute経由でOpenAI、Claude、DeepSeek、Grok、Qwenなど、多くの主要モデルにアクセスできます。gpt-6.1-sol: 関数呼び出しとreasoning.effort="max"にはResponsesを使用してください。Chat Completionsはツールなしのリクエストを受け付け、reasoning_effortの値としてlow、medium、high、xhighに対応しています。どちらのインターフェースもnoneとminimalは受け付けません。temperature、top_pおよび対数確率のオプションは省略してください。GPT 6.1 Solを参照してください。認証
Bearerトークン。例:Bearer sk-xxxxxxxxxx
リクエストパラメーター
string
必須
モデルマーケットプレイスに対応するモデル識別子。
MixRouteは複数のモデルに対応しています。完全な一覧はモデルマーケットプレイスで確認してください。
array
必須
会話メッセージの配列。各メッセージには
role(user/system/assistant)とcontentを含めます。number
ランダム性の制御。0〜2。値を高くすると、応答のランダム性が増します。
boolean
ストリーミング出力を有効にし、SSE形式のデータをチャンク単位で返します
integer
生成するトークンの最大数。レスポンスの長さを制御します
object
出力形式。
textまたはjson_object / json_schemaに対応number
Nucleusサンプリングのパラメータ。範囲は0~1で、temperatureの代わりに使用します。値を小さくすると、サンプリングがより保守的になります
number
頻度ペナルティ。-2~2。正の値は、頻出するトークンの繰り返しを減らします
number
存在ペナルティ。-2〜2。正の値を指定すると、新しい話題に言及しやすくなります。
string | array
停止シーケンス。指定した文字列が現れると生成を停止します
integer
乱数シード。同じシードを使用すると、結果の一貫性が高まります。
string
監視とレート制限に使用するエンドユーザー識別子
integer
プロンプトごとの応答候補数。デフォルトは1です。
object
トークンバイアス。トークンIDをバイアス値(-100~100)に対応付けます
array
ツール定義のリスト。各ツールには
typeとfunctionを含める必要があります。string
ツールの選択方法:
"auto" / "none" / "required"、またはツール名を指定基本的な例
- 非ストリーミングリクエスト
- ストリーミングリクエスト(SSE)
- Pythonの例
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="")
高度な機能
- ツール呼び出し
- 構造化出力
- 思考機能
- Qwenの拡張機能
- ウェブ検索
- GPTファイル入力
- Grokの推論
OpenAI互換のツール呼び出し形式に対応しています。
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"
}'
JSON Schemaを使用して、モデルの出力形式を制約します。
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シリーズは、深い思考機能に対応しています。レスポンスには、思考過程を示す
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フィールドが含まれます。Qwenシリーズは思考機能に対応しています。
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シリーズ(
gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna)は、高度な推論設定に対応しています。reasoning.mode: 実行モード。"standard"(デフォルト)または"pro"。Pro Modeではモデルが追加の処理を行い、難しいタスクでの信頼性を高めますreasoning.effort:推論の強度:none/low/medium/high/xhigh/max(maxは新しいレベル)
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は推論機能をサポートします。
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は追加の拡張パラメーターをサポートします。
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
}
}'
| パラメーター | 説明 |
|---|---|
enable_search | ウェブ検索を有効にする |
search_options.search_strategy | 検索戦略: standard/pro |
search_options.forced_search | 検索を強制 |
- Claudeの検索
- Grok検索
Claudeモデルはウェブ検索機能に対応しています。
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モデルはリアルタイムのウェブ検索に対応しています。
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モデルは、ファイル内容の直接処理をサポートします。対応するファイル形式には、PDF、Word、Excel、画像などがあります。
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"
}
}
]
}
]
}'
ファイルの処理能力はモデルによって異なります。必要なファイル形式に対応したモデルを選択してください。
Grokモデルは、強化された推論機能に対応しています。
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 | 説明 |
|---|---|
low | 高速な応答、基本的な推論 |
medium | バランスモード |
high | 深い推論、より高い精度 |
レスポンス形式
- 非ストリーミングレスポンス
- ストリーミングレスポンス
{
"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
}
}
ストリーミングレスポンスはServer-Sent Events(SSE)形式を使用します。各チャンクには差分のコンテンツが含まれます。ストリームは
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]で終了します。エラー処理
| エラーの種類 | 発生する状況 |
|---|---|
| AuthenticationError | APIキーが無効、または認証されていない |
| NotFoundError | モデルが存在しないか、対応していません |
| APIConnectionError | ネットワークの中断、またはサーバーが応答していない |
| RateLimitError | リクエストのレート制限を超過 |
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
}
}