claude-fable-5を呼び出してください。OpenAI互換のChat Completions APIもサポートされています。
主な機能
- Messages API - Anthropicネイティブのリクエスト・レスポンス形式
- OpenAI互換 - Chat Completions経由でも使用可能
- ストリーミング - SSEによる逐次出力
- システムプロンプト - トップレベルのシステム指示
- ツール利用 - Anthropicのツール定義をサポート
簡単な使用例
Messages API
- cURL
- Python
- ストリーミング
curl "https://api.mixroute.ai/v1/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-fable-5",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Explain quantum entanglement in simple terms."
}
]
}'
from anthropic import Anthropic
client = Anthropic(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai")
message = client.messages.create(
model="claude-fable-5",
max_tokens=256,
messages=[{"role": "user", "content": "Explain quantum entanglement in simple terms."}],
)
print(message.content[0].text)
from anthropic import Anthropic
client = Anthropic(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai")
with client.messages.stream(
model="claude-fable-5",
max_tokens=256,
messages=[{"role": "user", "content": "Write a short poem about the sea."}],
) as stream:
for text in stream.text_stream:
print(text, end="")
OpenAI互換API
- cURL
- Python
- ストリーミング
curl "https://api.mixroute.ai/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-fable-5",
"messages": [
{
"role": "user",
"content": "Explain quantum entanglement in simple terms."
}
],
"max_tokens": 256
}'
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")
response = client.chat.completions.create(
model="claude-fable-5",
messages=[{"role": "user", "content": "Explain quantum entanglement in simple terms."}],
max_tokens=256,
)
print(response.choices[0].message.content)
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")
stream = client.chat.completions.create(
model="claude-fable-5",
messages=[{"role": "user", "content": "Write a short poem about the sea."}],
max_tokens=256,
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
パラメータ
Messages API
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | はい | claude-fable-5である必要があります。 |
messages | array | はい | roleとcontentを含む入力メッセージ。 |
max_tokens | integer | はい | 生成するトークンの最大数。 |
system | string | array | いいえ | トップレベルのシステム指示。 |
stream | boolean | いいえ | SSEストリーミングを有効にします。 |
tools | array | いいえ | Anthropicのツール定義。 |
thinking | object | いいえ | 対応している場合の拡張思考の設定。 |
OpenAI互換API
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | はい | claude-fable-5である必要があります。 |
messages | array | はい | roleとcontentを含む会話メッセージ。 |
max_tokens | integer | いいえ | 生成するトークンの最大数。 |
stream | boolean | いいえ | SSEストリーミングを有効にします。デフォルト: false。 |
temperature | number | いいえ | モデルが対応している場合のサンプリング温度。 |
top_p | number | いいえ | 対応している場合のNucleusサンプリングのしきい値。 |
stop | string | array | いいえ | 生成を停止するシーケンス。 |
tools | array | いいえ | OpenAI互換のツール定義。 |