AI Gateway 経由で Anthropic Messages API 互換エンドポイントから中国オープンソース AI モデルを利用できます。
/api/ai/v1/anthropic/messages| パラメータ | 必須 | 説明 |
|---|---|---|
Authorization | 必須 | Bearer YOUR_API_KEY |
anthropic-version | 必須 | 固定値 2023-06-01 |
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | 必須 | モデル名、例: deepseek-v4.1-flash、qwen3.8-max |
messages | array | 必須 | 次の形式のメッセージ配列 |
max_tokens | integer | 必須 | 出力トークンの最大数 |
stream | boolean | 任意 | ストリーミング応答を有効にします。SSEの場合はtrueに設定してください |
| パラメータ | 型 | 説明 |
|---|---|---|
id | string | 一意の応答識別子 |
model | string | 使用されたモデル |
content | string | 生成されたテキスト内容 |
usage | object | トークン使用統計 |
curl --location 'https://your-domain.com/api/ai/v1/anthropic/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'anthropic-version: 2023-06-01' \
--data '{
"model": "deepseek-v4.1-flash",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, who are you?"}
]
}'import requests
response = requests.post(
"https://your-domain.com/api/ai/v1/anthropic/messages",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
"anthropic-version": "2023-06-01"
},
json={
"model": "deepseek-v4.1-flash",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, who are you?"}
]
}
)
print(response.json())curl --location 'https://your-domain.com/api/ai/v1/anthropic/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'anthropic-version: 2023-06-01' \
--data '{
"model": "deepseek-v4.1-flash",
"max_tokens": 1024,
"stream": true,
"messages": [{"role": "user", "content": "Hello"}]
}'