curl --request POST \
--url 'https://api.elkapi.com/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": false,
"max_tokens": 1024,
"response_format": "json"
}'
import requests
url = "https://api.elkapi.com/v1/chat/completions"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": False,
"max_tokens": 1024,
"response_format": "json"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/chat/completions";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": false,
"max_tokens": 1024,
"response_format": "json"
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"id": "id",
"object": "chat.completion",
"created": 1,
"model": "gpt-5.5",
"choices": [
{
"index": 1,
"message": {
"role": "user",
"content": "こんにちは、自己紹介してください",
"name": "name",
"tool_calls": [
{
"id": {},
"type": {},
"function": {}
}
],
"tool_call_id": "tool_call_id",
"reasoning_content": "reasoning_content"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1,
"prompt_tokens_details": {
"cached_tokens": 1,
"text_tokens": 1,
"audio_tokens": 1,
"image_tokens": 1
},
"completion_tokens_details": {
"text_tokens": 1,
"audio_tokens": 1,
"reasoning_tokens": 1
}
},
"system_fingerprint": "system_fingerprint"
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
ネイティブ OpenAI 形式
Chat Completions
- 会話履歴に基づいてモデル応答を作成します。ストリーミングと非ストリーミングの応答に対応します。
- OpenAI Chat Completions API と互換性があります。
POST
/
v1
/
chat
/
completions
curl --request POST \
--url 'https://api.elkapi.com/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": false,
"max_tokens": 1024,
"response_format": "json"
}'
import requests
url = "https://api.elkapi.com/v1/chat/completions"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": False,
"max_tokens": 1024,
"response_format": "json"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/chat/completions";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": false,
"max_tokens": 1024,
"response_format": "json"
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"id": "id",
"object": "chat.completion",
"created": 1,
"model": "gpt-5.5",
"choices": [
{
"index": 1,
"message": {
"role": "user",
"content": "こんにちは、自己紹介してください",
"name": "name",
"tool_calls": [
{
"id": {},
"type": {},
"function": {}
}
],
"tool_call_id": "tool_call_id",
"reasoning_content": "reasoning_content"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1,
"prompt_tokens_details": {
"cached_tokens": 1,
"text_tokens": 1,
"audio_tokens": 1,
"image_tokens": 1
},
"completion_tokens_details": {
"text_tokens": 1,
"audio_tokens": 1,
"reasoning_tokens": 1
}
},
"system_fingerprint": "system_fingerprint"
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
curl --request POST \
--url 'https://api.elkapi.com/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": false,
"max_tokens": 1024,
"response_format": "json"
}'
import requests
url = "https://api.elkapi.com/v1/chat/completions"
headers = {
"Authorization": "Bearer <token>"
}
headers["Content-Type"] = "application/json"
payload = {
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": False,
"max_tokens": 1024,
"response_format": "json"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.json())
const url = "https://api.elkapi.com/v1/chat/completions";
const headers = {
"Authorization": "Bearer <token>"
};
headers["Content-Type"] = "application/json";
const payload = {
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "こんにちは、自己紹介してください"
}
],
"temperature": 1,
"stream": false,
"max_tokens": 1024,
"response_format": "json"
};
const response = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify(payload)
});
console.log(await response.json());
{
"id": "id",
"object": "chat.completion",
"created": 1,
"model": "gpt-5.5",
"choices": [
{
"index": 1,
"message": {
"role": "user",
"content": "こんにちは、自己紹介してください",
"name": "name",
"tool_calls": [
{
"id": {},
"type": {},
"function": {}
}
],
"tool_call_id": "tool_call_id",
"reasoning_content": "reasoning_content"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1,
"prompt_tokens_details": {
"cached_tokens": 1,
"text_tokens": 1,
"audio_tokens": 1,
"image_tokens": 1
},
"completion_tokens_details": {
"text_tokens": 1,
"audio_tokens": 1,
"reasoning_tokens": 1
}
},
"system_fingerprint": "system_fingerprint"
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
{
"error": {
"message": "message",
"type": "type",
"param": "param",
"code": "code"
}
}
Authorizations
string
必須
すべてのエンドポイントで Bearer Token 認証が必要です。リクエストヘッダーに追加します:
Authorization: Bearer YOUR_API_KEY
Body
string
デフォルト:"gpt-5.5"
必須
モデルID例:
gpt-5.5array<object>
必須
number
デフォルト:"1"
サンプリング温度
number
デフォルト:"1"
ニュークリアスサンプリングパラメーター
integer
デフォルト:"1"
生成数
boolean
デフォルト:"false"
ストリーミング応答にするかどうか
string or array<string>
停止シーケンス
integer
最大生成トークン数
integer
最大補完トークン数
number
デフォルト:"0"
number
デフォルト:"0"
object
string
integer
string
推論強度(推論対応モデル用)指定可能な値:
low、medium、higharray<string>
Response
string
string
例:
chat.completioninteger
string
デフォルト:"gpt-5.5"
例:
gpt-5.5array<object>
object
string