チャット会話リクエストの作成
curl --request POST \
--url https://api.highwayapi.ai/openai/v1/chat/completions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "<string>",
"messages": [
{
"content": {
"type": "<string>",
"text": "<string>",
"image_url": "<string>",
"video_url": "<string>"
},
"role": "<string>",
"name": "<string>"
}
],
"max_tokens": 123,
"stream": {},
"stream_options": {
"include_usage": true
},
"n": {},
"seed": {},
"frequency_penalty": {},
"presence_penalty": {},
"repetition_penalty": {},
"stop": {},
"temperature": {},
"top_p": {},
"top_k": {},
"min_p": {},
"logit_bias": {},
"logprobs": {},
"top_logprobs": {},
"tools": {
"type": "<string>",
"function": {
"name": "<string>",
"description": {},
"parameters": {},
"strict": true
}
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": {},
"schema": {},
"strict": true
}
},
"separate_reasoning": {},
"enable_thinking": {}
}
'import requests
url = "https://api.highwayapi.ai/openai/v1/chat/completions"
payload = {
"model": "<string>",
"messages": [
{
"content": {
"type": "<string>",
"text": "<string>",
"image_url": "<string>",
"video_url": "<string>"
},
"role": "<string>",
"name": "<string>"
}
],
"max_tokens": 123,
"stream": {},
"stream_options": { "include_usage": True },
"n": {},
"seed": {},
"frequency_penalty": {},
"presence_penalty": {},
"repetition_penalty": {},
"stop": {},
"temperature": {},
"top_p": {},
"top_k": {},
"min_p": {},
"logit_bias": {},
"logprobs": {},
"top_logprobs": {},
"tools": {
"type": "<string>",
"function": {
"name": "<string>",
"description": {},
"parameters": {},
"strict": True
}
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": {},
"schema": {},
"strict": True
}
},
"separate_reasoning": {},
"enable_thinking": {}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
model: '<string>',
messages: [
{
content: {
type: '<string>',
text: '<string>',
image_url: '<string>',
video_url: '<string>'
},
role: '<string>',
name: '<string>'
}
],
max_tokens: 123,
stream: {},
stream_options: {include_usage: true},
n: {},
seed: {},
frequency_penalty: {},
presence_penalty: {},
repetition_penalty: {},
stop: {},
temperature: {},
top_p: {},
top_k: {},
min_p: {},
logit_bias: {},
logprobs: {},
top_logprobs: {},
tools: {
type: '<string>',
function: {name: '<string>', description: {}, parameters: {}, strict: true}
},
response_format: {
type: '<string>',
json_schema: {name: '<string>', description: {}, schema: {}, strict: true}
},
separate_reasoning: {},
enable_thinking: {}
})
};
fetch('https://api.highwayapi.ai/openai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/openai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'messages' => [
[
'content' => [
'type' => '<string>',
'text' => '<string>',
'image_url' => '<string>',
'video_url' => '<string>'
],
'role' => '<string>',
'name' => '<string>'
]
],
'max_tokens' => 123,
'stream' => [
],
'stream_options' => [
'include_usage' => true
],
'n' => [
],
'seed' => [
],
'frequency_penalty' => [
],
'presence_penalty' => [
],
'repetition_penalty' => [
],
'stop' => [
],
'temperature' => [
],
'top_p' => [
],
'top_k' => [
],
'min_p' => [
],
'logit_bias' => [
],
'logprobs' => [
],
'top_logprobs' => [
],
'tools' => [
'type' => '<string>',
'function' => [
'name' => '<string>',
'description' => [
],
'parameters' => [
],
'strict' => true
]
],
'response_format' => [
'type' => '<string>',
'json_schema' => [
'name' => '<string>',
'description' => [
],
'schema' => [
],
'strict' => true
]
],
'separate_reasoning' => [
],
'enable_thinking' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.highwayapi.ai/openai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"image_url\": \"<string>\",\n \"video_url\": \"<string>\"\n },\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"max_tokens\": 123,\n \"stream\": {},\n \"stream_options\": {\n \"include_usage\": true\n },\n \"n\": {},\n \"seed\": {},\n \"frequency_penalty\": {},\n \"presence_penalty\": {},\n \"repetition_penalty\": {},\n \"stop\": {},\n \"temperature\": {},\n \"top_p\": {},\n \"top_k\": {},\n \"min_p\": {},\n \"logit_bias\": {},\n \"logprobs\": {},\n \"top_logprobs\": {},\n \"tools\": {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"parameters\": {},\n \"strict\": true\n }\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"schema\": {},\n \"strict\": true\n }\n },\n \"separate_reasoning\": {},\n \"enable_thinking\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.highwayapi.ai/openai/v1/chat/completions")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"image_url\": \"<string>\",\n \"video_url\": \"<string>\"\n },\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"max_tokens\": 123,\n \"stream\": {},\n \"stream_options\": {\n \"include_usage\": true\n },\n \"n\": {},\n \"seed\": {},\n \"frequency_penalty\": {},\n \"presence_penalty\": {},\n \"repetition_penalty\": {},\n \"stop\": {},\n \"temperature\": {},\n \"top_p\": {},\n \"top_k\": {},\n \"min_p\": {},\n \"logit_bias\": {},\n \"logprobs\": {},\n \"top_logprobs\": {},\n \"tools\": {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"parameters\": {},\n \"strict\": true\n }\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"schema\": {},\n \"strict\": true\n }\n },\n \"separate_reasoning\": {},\n \"enable_thinking\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/openai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"image_url\": \"<string>\",\n \"video_url\": \"<string>\"\n },\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"max_tokens\": 123,\n \"stream\": {},\n \"stream_options\": {\n \"include_usage\": true\n },\n \"n\": {},\n \"seed\": {},\n \"frequency_penalty\": {},\n \"presence_penalty\": {},\n \"repetition_penalty\": {},\n \"stop\": {},\n \"temperature\": {},\n \"top_p\": {},\n \"top_k\": {},\n \"min_p\": {},\n \"logit_bias\": {},\n \"logprobs\": {},\n \"top_logprobs\": {},\n \"tools\": {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"parameters\": {},\n \"strict\": true\n }\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"schema\": {},\n \"strict\": true\n }\n },\n \"separate_reasoning\": {},\n \"enable_thinking\": {}\n}"
response = http.request(request)
puts response.read_body{
"choices": [
{
"finish_reason": "<string>",
"index": 123,
"message": {
"role": "<string>",
"content": {},
"reasoning_content": {}
}
}
],
"created": 123,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123
}
}大規模言語モデル
チャット会話リクエストの作成
POST
/
openai
/
v1
/
chat
/
completions
チャット会話リクエストの作成
curl --request POST \
--url https://api.highwayapi.ai/openai/v1/chat/completions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "<string>",
"messages": [
{
"content": {
"type": "<string>",
"text": "<string>",
"image_url": "<string>",
"video_url": "<string>"
},
"role": "<string>",
"name": "<string>"
}
],
"max_tokens": 123,
"stream": {},
"stream_options": {
"include_usage": true
},
"n": {},
"seed": {},
"frequency_penalty": {},
"presence_penalty": {},
"repetition_penalty": {},
"stop": {},
"temperature": {},
"top_p": {},
"top_k": {},
"min_p": {},
"logit_bias": {},
"logprobs": {},
"top_logprobs": {},
"tools": {
"type": "<string>",
"function": {
"name": "<string>",
"description": {},
"parameters": {},
"strict": true
}
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": {},
"schema": {},
"strict": true
}
},
"separate_reasoning": {},
"enable_thinking": {}
}
'import requests
url = "https://api.highwayapi.ai/openai/v1/chat/completions"
payload = {
"model": "<string>",
"messages": [
{
"content": {
"type": "<string>",
"text": "<string>",
"image_url": "<string>",
"video_url": "<string>"
},
"role": "<string>",
"name": "<string>"
}
],
"max_tokens": 123,
"stream": {},
"stream_options": { "include_usage": True },
"n": {},
"seed": {},
"frequency_penalty": {},
"presence_penalty": {},
"repetition_penalty": {},
"stop": {},
"temperature": {},
"top_p": {},
"top_k": {},
"min_p": {},
"logit_bias": {},
"logprobs": {},
"top_logprobs": {},
"tools": {
"type": "<string>",
"function": {
"name": "<string>",
"description": {},
"parameters": {},
"strict": True
}
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": {},
"schema": {},
"strict": True
}
},
"separate_reasoning": {},
"enable_thinking": {}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
model: '<string>',
messages: [
{
content: {
type: '<string>',
text: '<string>',
image_url: '<string>',
video_url: '<string>'
},
role: '<string>',
name: '<string>'
}
],
max_tokens: 123,
stream: {},
stream_options: {include_usage: true},
n: {},
seed: {},
frequency_penalty: {},
presence_penalty: {},
repetition_penalty: {},
stop: {},
temperature: {},
top_p: {},
top_k: {},
min_p: {},
logit_bias: {},
logprobs: {},
top_logprobs: {},
tools: {
type: '<string>',
function: {name: '<string>', description: {}, parameters: {}, strict: true}
},
response_format: {
type: '<string>',
json_schema: {name: '<string>', description: {}, schema: {}, strict: true}
},
separate_reasoning: {},
enable_thinking: {}
})
};
fetch('https://api.highwayapi.ai/openai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/openai/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'messages' => [
[
'content' => [
'type' => '<string>',
'text' => '<string>',
'image_url' => '<string>',
'video_url' => '<string>'
],
'role' => '<string>',
'name' => '<string>'
]
],
'max_tokens' => 123,
'stream' => [
],
'stream_options' => [
'include_usage' => true
],
'n' => [
],
'seed' => [
],
'frequency_penalty' => [
],
'presence_penalty' => [
],
'repetition_penalty' => [
],
'stop' => [
],
'temperature' => [
],
'top_p' => [
],
'top_k' => [
],
'min_p' => [
],
'logit_bias' => [
],
'logprobs' => [
],
'top_logprobs' => [
],
'tools' => [
'type' => '<string>',
'function' => [
'name' => '<string>',
'description' => [
],
'parameters' => [
],
'strict' => true
]
],
'response_format' => [
'type' => '<string>',
'json_schema' => [
'name' => '<string>',
'description' => [
],
'schema' => [
],
'strict' => true
]
],
'separate_reasoning' => [
],
'enable_thinking' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.highwayapi.ai/openai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"image_url\": \"<string>\",\n \"video_url\": \"<string>\"\n },\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"max_tokens\": 123,\n \"stream\": {},\n \"stream_options\": {\n \"include_usage\": true\n },\n \"n\": {},\n \"seed\": {},\n \"frequency_penalty\": {},\n \"presence_penalty\": {},\n \"repetition_penalty\": {},\n \"stop\": {},\n \"temperature\": {},\n \"top_p\": {},\n \"top_k\": {},\n \"min_p\": {},\n \"logit_bias\": {},\n \"logprobs\": {},\n \"top_logprobs\": {},\n \"tools\": {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"parameters\": {},\n \"strict\": true\n }\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"schema\": {},\n \"strict\": true\n }\n },\n \"separate_reasoning\": {},\n \"enable_thinking\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.highwayapi.ai/openai/v1/chat/completions")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"image_url\": \"<string>\",\n \"video_url\": \"<string>\"\n },\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"max_tokens\": 123,\n \"stream\": {},\n \"stream_options\": {\n \"include_usage\": true\n },\n \"n\": {},\n \"seed\": {},\n \"frequency_penalty\": {},\n \"presence_penalty\": {},\n \"repetition_penalty\": {},\n \"stop\": {},\n \"temperature\": {},\n \"top_p\": {},\n \"top_k\": {},\n \"min_p\": {},\n \"logit_bias\": {},\n \"logprobs\": {},\n \"top_logprobs\": {},\n \"tools\": {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"parameters\": {},\n \"strict\": true\n }\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"schema\": {},\n \"strict\": true\n }\n },\n \"separate_reasoning\": {},\n \"enable_thinking\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/openai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"image_url\": \"<string>\",\n \"video_url\": \"<string>\"\n },\n \"role\": \"<string>\",\n \"name\": \"<string>\"\n }\n ],\n \"max_tokens\": 123,\n \"stream\": {},\n \"stream_options\": {\n \"include_usage\": true\n },\n \"n\": {},\n \"seed\": {},\n \"frequency_penalty\": {},\n \"presence_penalty\": {},\n \"repetition_penalty\": {},\n \"stop\": {},\n \"temperature\": {},\n \"top_p\": {},\n \"top_k\": {},\n \"min_p\": {},\n \"logit_bias\": {},\n \"logprobs\": {},\n \"top_logprobs\": {},\n \"tools\": {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"parameters\": {},\n \"strict\": true\n }\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": {},\n \"schema\": {},\n \"strict\": true\n }\n },\n \"separate_reasoning\": {},\n \"enable_thinking\": {}\n}"
response = http.request(request)
puts response.read_body{
"choices": [
{
"finish_reason": "<string>",
"index": 123,
"message": {
"role": "<string>",
"content": {},
"reasoning_content": {}
}
}
],
"created": 123,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123
}
}指定されたチャット会話に基づいてモデルの応答を生成します
リクエストヘッダー
string
必須
列挙値:
application/jsonstring
必須
Bearer 認証形式: Bearer {{API Key}}。
リクエストボディ
string
必須
使用するモデル名。
object[]
必須
現在の会話を構成するメッセージのリスト。
表示 プロパティ
表示 プロパティ
string | object[] | null
必須
メッセージの内容。すべてのメッセージには content が必要です。関数呼び出しを含む assistant メッセージの場合、content は null にできます。モダリティに応じて、以下のパラメータを使用できます。
- テキスト内容
- 画像内容
- 動画内容
オプション 1:
文字列型を使用してメッセージのテキスト内容を表すことができます。
オプション 2:
コンテンツ部分の配列、object[] を使用します。詳細フィールドは以下のとおりです:
string
必須
コンテンツ部分のタイプ。この場合は
text です。string
必須
テキスト内容。
ビジョン言語モデルでのみ使用できます。
コンテンツ部分の配列、object[]。詳細フィールドは以下のとおりです:
string
必須
コンテンツ部分のタイプ。この場合は
image_url です。string
必須
メッセージ作成者のロール。system、user、assistant のいずれかです。列挙値:
system, user, assistantstring
このメッセージ作成者の名前。a-z、A-Z、0-9、アンダースコアを含めることができ、最大長は 64 文字です。
integer
必須
補完で生成される最大トークン数。プロンプト(以前のメッセージ)に max_tokens のトークン数を加えた値がモデルのコンテキスト長を超える場合、動作は context_length_exceeded_behavior によって異なります。デフォルトでは、エラーを返すのではなく、max_tokens がコンテキストウィンドウに収まるように引き下げられます。
boolean | null
デフォルト:false
部分的な進捗をストリーミングで返すかどうか。設定すると、トークンはデータ専用のサーバー送信イベント (SSE) として利用可能になり次第送信され、ストリームは
data: [DONE] メッセージで終了します。object | null
ストリーミング応答のオプション。stream が true に設定されている場合にのみ設定します。
表示 プロパティ
表示 プロパティ
boolean
設定すると、data: [DONE] メッセージの前に追加の chunk がストリーミングされます。この chunk の usage フィールドにはリクエスト全体のトークン使用統計が表示され、choices フィールドは常に空の配列になります。他のすべての chunk にも usage フィールドが含まれますが、値は null です。
integer | null
デフォルト:1
各プロンプトに対して生成する補完の数。注意:このパラメータは多数の補完を生成するため、トークン割り当てを急速に消費する可能性があります。慎重に使用し、max_tokens と stop に適切な設定を行ってください。必須範囲:
1 < x < 128integer | null
指定した場合、同じ seed とパラメータでリクエストを繰り返すと同じ結果が返るよう、システムは可能な限り決定論的にサンプリングを行います。
number | null
デフォルト:0
正の値は、新しいトークンがテキスト内に既に出現している頻度に基づいてペナルティを与え、モデルが同じ行を逐語的に繰り返す可能性を低下させます。目的が繰り返しサンプルを少し減らすだけであれば、0.1 から 1 の間が妥当な値です。繰り返しを強く抑制することが目的であれば、係数を 2 まで増やすこともできますが、サンプル品質が大幅に低下する可能性があります。負の値は、繰り返しの可能性を高めるために使用できます。少なくとも 1 回出現したトークンに固定率でペナルティを与える presence_penalty も参照してください。必須範囲:
-2 < x < 2number | null
デフォルト:0
正の値は、新しいトークンがテキスト内に出現しているかどうかに基づいてペナルティを与え、モデルが新しいトピックについて話す可能性を高めます。目的が繰り返しサンプルを少し減らすだけであれば、0.1 から 1 の間が妥当な値です。繰り返しを強く抑制することが目的であれば、係数を 2 まで増やすこともできますが、サンプル品質が大幅に低下する可能性があります。負の値は、繰り返しの可能性を高めるために使用できます。トークンの出現頻度に基づいて増加率でトークンにペナルティを与える
frequency_penalty も参照してください。必須範囲:-2 < x < 2number | null
繰り返しを抑制または促進するために、繰り返されるトークンにペナルティを適用します。値 1.0 はペナルティなしを意味し、自由な繰り返しを許可します。1.0 より大きい値は繰り返しにペナルティを与え、繰り返しトークンの可能性を低下させます。0.0 から 1.0 の間の値は繰り返しに報酬を与え、繰り返しトークンの機会を増やします。良好なバランスを得るには、通常 1.2 の値を使用することをお勧めします。ペナルティは、生成された出力とデコーダー専用モデルのプロンプトに適用されることに注意してください。必須範囲:
0 < x < 2string | null
API がそれ以上のトークン生成を停止する最大 4 つのシーケンス。返されるテキストには停止シーケンスが含まれます。
number | null
デフォルト:1
使用するサンプリング温度。0 から 2 の間です。0.8 のように高い値にすると出力はよりランダムになり、0.2 のように低い値にするとより集中し決定論的になります。通常、この項目または
top_p のどちらか一方のみを変更し、両方を同時に変更しないことをお勧めします。必須範囲:0 < x < 2number | null
サンプリング温度の代替手法で、核サンプリングと呼ばれます。モデルは top_p の確率質量を持つトークン結果を考慮します。したがって、0.1 は上位 10% の確率質量を構成するトークンのみを考慮することを意味します。通常、この項目または temperature のどちらか一方のみを変更し、両方を同時に変更しないことをお勧めします。必須範囲:
0 < x <= 1integer | null
Top-k サンプリングはもう 1 つのサンプリング手法で、最も可能性の高い次の k 個のトークンがフィルタリングされ、確率質量はこれら k 個の次トークン間でのみ再分配されます。k の値は、テキスト生成中の各ステップにおける次トークンの候補数を制御します。必須範囲:
1 < x < 128number | null
最も可能性の高いトークンの確率に対して、トークンが考慮される最小確率を表します。必須範囲:
0 <= x <= 1map[string, integer] | null
指定したトークンが補完に出現する可能性を変更します。JSON オブジェクトを受け取り、トークンを -100 から 100 の間の関連するバイアス値にマッピングします。
数学的には、サンプリング前にモデルが生成した logits にバイアスが追加されます。正確な効果はモデルによって異なります。たとえば、
"logit_bias":{"1024": 6} を設定すると、token ID が 1024 のトークンの可能性が高まります。boolean | null
デフォルト:false
出力トークンの対数確率を返すかどうか。true の場合、メッセージ内容内の各出力トークンの対数確率が返されます。
integer | null
0 から 20 の間の整数で、各トークン位置で返される最も可能性の高いトークン数を指定します。各トークンには関連する対数確率があります。このパラメータを使用する場合は、
logprobs を true に設定する必要があります。必須範囲:0 <= x <= 20object[] | null
モデルが呼び出せるツールのリスト。現在、ツールとしてサポートされているのは関数のみです。モデルが JSON 入力を生成できる関数のリストを提供するために使用します。関数呼び出しの詳細については、関数呼び出しガイドを参照してください。
表示 プロパティ
表示 プロパティ
string
必須
ツールのタイプ。サポートされるタイプ:
functionobject
必須
表示 プロパティ
表示 プロパティ
string
必須
呼び出す関数名。a-z、A-Z、0-9、またはアンダースコアとハイフンを含む必要があり、最大長は 64 です。
string | null
関数の説明。モデルがいつ、どのように関数を呼び出すかを選択するために使用します。
object | null
関数が受け取るパラメータ。JSON Schema オブジェクトとして記述します。形式に関するドキュメントは JSON Schema リファレンスを参照してください。
boolean
デフォルト:false
関数呼び出しの生成時に厳密なスキーマ遵守を有効にするかどうか。true に設定すると、モデルは parameters フィールドで定義された正確なスキーマに従います。
object | null
モデルに特定の出力形式を生成させることができます。
{ "type": "json_schema", "json_schema": {...} } に設定すると構造化出力が有効になり、モデルが提供された JSON schema に一致することを保証します。{ "type": "json_object" } に設定すると従来の JSON モードが有効になり、モデルが生成するメッセージが有効な JSON であることを保証します。対応しているモデルでは、json_schema の使用をお勧めします。表示 プロパティ
表示 プロパティ
string
デフォルト:"text"
必須
列挙値:
text, json_object, json_schemaobject | null
JSON Schema 応答形式。構造化された JSON 応答を生成するために使用します。
type が json_schema に設定されている場合にのみサポートされ、type が json_schema に設定されている場合は必須です。詳細は構造化出力ガイドを参照してください。表示 プロパティ
表示 プロパティ
string
必須
応答形式の名前。a-z、A-Z、0-9、またはアンダースコアとハイフンを含む必要があり、最大長は 64 です。
string | null
応答形式の説明。モデルがその形式でどのように応答するかを判断するために使用します。
object | null
応答形式のスキーマ。JSON Schema オブジェクトとして記述します。JSON schema の構築方法についてはこちらをご覧ください。サポートされるタイプ:
string, number, integer, boolean, array, object, enum, anyOf。boolean
デフォルト:false
出力生成時に厳密なスキーマ遵守を有効にするかどうか。true に設定すると、モデルは常に schema フィールドで定義された正確なスキーマに従います。strict が true の場合、JSON Schema のサブセットのみがサポートされます。
strict: true を指定して構造化出力を有効にし、サポートされていない JSON Schema で API を呼び出した場合、エラーが返されます。boolean | null
デフォルト:false
推論を “content” から分離して “reasoning_content” フィールドに入れるかどうか。サポートされるモデル:
deepseek/deepseek-r1-turbo
boolean | null
デフォルト:true
思考モードと非思考モードの切り替えを制御します。サポートされるモデル:
zai-org/glm-4.5
レスポンス情報
object[]
必須
チャット補完オプションのリスト。
表示 プロパティ
表示 プロパティ
string
必須
モデルがトークン生成を停止した理由。モデルが自然な停止点または提供された停止シーケンスに到達した場合は “stop”、リクエストで指定された最大トークン数に到達した場合は “length” です。利用可能なオプション:
stop, lengthinteger
必須
チャット補完オプションのインデックス。
integer
必須
応答が生成された Unix 時刻(秒単位)。
string
必須
応答の一意の識別子。
string
必須
チャット補完に使用されたモデル。
string
必須
オブジェクトタイプ。常に
chat.completion です。⌘I