OpenAI チャット補完 API を会話に使用します。これは従来の OpenAI チャット API 形式です。
/api/ai/v1/chat/completionsBearer YOUR_API_KEY| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | 必須 | モデル名、例: deepseek-v4.1-flash、qwen3.8-max |
messages | array | 必須 | 次の形式のメッセージ配列 |
max_tokens | integer | 任意 | 出力トークンの最大数 |
temperature | float | 任意 | サンプリング温度(0-2)。ランダム性を制御します |
stream | boolean | 任意 | ストリーミング応答を有効にします。SSEの場合はtrueに設定してください |
| パラメータ | 型 | 説明 |
|---|---|---|
id | string | 一意の応答識別子 |
model | string | 使用されたモデル |
choices | array | 応答選択肢の配列。通常、最初のものを選択 |
usage | object | トークン使用統計 |
curl --location 'https://your-domain.com/api/ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"messages": [
{"role": "user", "content": "Hello, who are you?"}
],
"max_tokens": 1000,
"temperature": 0.7
}'import requests
response = requests.post(
"https://your-domain.com/api/ai/v1/chat/completions",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
json={
"model": "deepseek-v4.1-flash",
"messages": [
{"role": "user", "content": "Hello, who are you?"}
],
"max_tokens": 1000,
"temperature": 0.7
}
)
print(response.json())curl --location 'https://your-domain.com/api/ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 1000,
"stream": true
}'