
GPT-5 と GPT-5.2 に API 経由でアクセスする方法 - 完全開発者ガイド
C
Crazyrouter Team
January 23, 2026
20 views日本語Tutorial
Share:
OpenAI はこれまでで最も強力なモデルである GPT-5、GPT-5.2、そして推論に特化した o3-pro をリリースしました。本ガイドでは、Crazyrouter の統合 API を通じて、これら最先端モデルにアクセスする方法を説明します。
対応している OpenAI モデル#
Crazyrouter は、OpenAI のモデルラインナップすべてにアクセスできます:
| Model | Input ($/1M tokens) | Output ($/1M tokens) | Best For |
|---|---|---|---|
| gpt-5.2 | $1.75 | $14.00 | Latest flagship, complex tasks |
| gpt-5.2-pro | $3.50 | $28.00 | Enhanced reasoning |
| gpt-5 | $1.25 | $10.00 | General tasks |
| gpt-5-pro | $2.50 | $20.00 | Advanced analysis |
| gpt-5-mini | $0.25 | $2.00 | Cost-effective |
| gpt-5-nano | $0.05 | $0.40 | High-volume tasks |
| o3-pro | $20.00 | $80.00 | Complex reasoning |
| o3-mini | $1.10 | $4.40 | Efficient reasoning |
| o4-mini | $1.10 | $4.40 | Latest reasoning model |
クイックスタート#
1. API キーを取得する#
- Crazyrouter Console にアクセス
- 「Token Management」に移動
- 「Create Token」をクリック
- API キー(
sk-で始まる)をコピー
2. 最初のリクエストを送信する#
Python を使う(推奨)#
python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://crazyrouter.com/v1",
default_headers={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
)
response = client.chat.completions.create(
model="gpt-5.2",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
],
temperature=0.7,
max_tokens=1000
)
print(response.choices[0].message.content)
Node.js を使う#
javascript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-your-api-key',
baseURL: 'https://crazyrouter.com/v1',
defaultHeaders: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
});
async function main() {
const response = await client.chat.completions.create({
model: 'gpt-5.2',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Explain quantum computing in simple terms.' }
],
temperature: 0.7
});
console.log(response.choices[0].message.content);
}
main();
curl を使う#
bash
curl https://crazyrouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
-d '{
"model": "gpt-5.2",
"messages": [{"role": "user", "content": "Hello, GPT-5.2!"}],
"temperature": 0.7
}'
ストリーミングレスポンス#
リアルタイム出力のためには、ストリーミングを有効にします:
python
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://crazyrouter.com/v1",
default_headers={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
}
)
stream = client.chat.completions.create(
model="gpt-5.2",
messages=[{"role": "user", "content": "Write a short story about AI."}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
推論モデル (o3-pro) の利用#
o3-pro モデルは、複雑な推論タスクで優れた性能を発揮します:
python
response = client.chat.completions.create(
model="o3-pro",
messages=[
{"role": "user", "content": "Solve this step by step: If a train travels 120 miles in 2 hours, then stops for 30 minutes, then travels another 90 miles in 1.5 hours, what is the average speed for the entire journey including the stop?"}
]
)
print(response.choices[0].message.content)
GPT-5 Codex モデル#
コード生成タスクには、専用の codex モデルを使用します:
python
response = client.chat.completions.create(
model="gpt-5-codex",
messages=[
{"role": "user", "content": "Write a Python function to implement binary search"}
]
)
利用可能な codex バリアント: gpt-5-codex, gpt-5-codex-high, gpt-5-codex-medium, gpt-5-codex-low, gpt-5.2-codex
ベストプラクティス#
- 適切なモデルを選ぶ: シンプルなタスクには gpt-5-nano、複雑なタスクには gpt-5.2 を使用
- 適切な temperature を設定する: 事実ベースのタスクには低め(0.1〜0.3)、クリエイティブなタスクには高め(0.7〜1.0)
- ストリーミングを活用する: チャットアプリでより良いユーザー体験を提供するため
- エラーを適切に処理する: レート制限に備えてリトライロジックを実装する
次のステップ#
- 詳細なコストは Model Pricing を参照
- 高度な機能については API Documentation を読む
- サポートが必要な場合は Discord Community に参加
質問がある場合は、support@crazyrouter.com までお問い合わせください


