Create Chat Completion
Creates a model response from conversation history with streaming, tools, and usage accounting.
Authorization
Authorization: Bearer sk-your-key
Content-Type
application/json
モデル
gpt-4o, gpt-4.1, gpt-5, o3, o4-mini
リクエスト例
curl -X POST https://api.routekey.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Hello from Route Key"
}
],
"stream": false
}'レスポンス例
{
"id": "chatcmpl_xxx",
"object": "chat.completion",
"created": 0,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello!"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 3,
"total_tokens": 11
}
}cURL 例
curl -X POST 'https://api.routekey.ai/v1/chat/completions' \
-H 'Authorization: Bearer sk-your-key'
-H 'Content-Type: application/json'
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Hello from Route Key"
}
],
"stream": false
}'パラメータ
| Name | 型 | 必須 | Description |
|---|---|---|---|
model | string | はい | モデル名 |
messages | array<object> | はい | チャット |
temperature | number | いいえ | Temperature |
top_p | number | いいえ | Top P |
stream | boolean | いいえ | リアルタイム |
max_tokens | integer | いいえ | Max tokens |
tools | array<object> | いいえ | Tools |
response_format | object | いいえ | Response format |
レスポンス
| Name | 型 | 必須 | Description |
|---|---|---|---|
id | string | - | ID |
object | string | - | Object |
created | integer | - | Created |
model | string | - | モデル名 |
choices | array<object> | - | Choices |
usage | object | - | Usage |
注記
- OpenAI Chat Completions
- Use the same request shape as the matching provider API when the backend channel is enabled.