curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/gpt-4o",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"status": "completed",
"model": "openai/gpt-4o",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}
LLM
Create a response
POST
/
v1
/
responses
curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/gpt-4o",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"status": "completed",
"model": "openai/gpt-4o",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}
OpenAI Responses APIフォーマットを使用して、ストリーミングまたは非ストリーミングのレスポンスを作成します。
認証
string
必須
Bearerトークン。APIキーをAuthorizationヘッダーのBearerトークンとして使用してください。Format:
Bearer <SUNRA_KEY>リクエスト
このエンドポイントはJSONオブジェクトを受け付けます。string
必須
レスポンス生成に使用するモデルID。利用可能なモデルは sunra.ai/models で確認できます。
string | object[]
レスポンスリクエストの入力。文字列または入力アイテムの配列を指定できます。
string | null
モデルのコンテキストの最初のアイテムとしてシステム(または開発者)メッセージを挿入します。
inputと共に使用する場合、instructionsは入力の先頭に挿入されます。boolean
デフォルト:false
trueに設定すると、サーバー送信イベント(SSE)を使用してレスポンスがストリーミングされます。integer
可視出力トークンと推論トークンを含む、出力トークン数の上限。
number
デフォルト:1
0から2の間のサンプリング温度。値が高いほどランダム性が増加します。
number
デフォルト:1
核サンプリングパラメータ。temperatureによるサンプリングの代替です。
number
デフォルト:0
-2.0から2.0の間の数値。正の値は、テキスト中の既存の頻度に基づいて新しいトークンにペナルティを課します。
number
デフォルト:0
-2.0から2.0の間の数値。正の値は、テキスト中に既に出現しているかどうかに基づいて新しいトークンにペナルティを課します。
object[]
string | object
ツール選択の動作を制御します。サポートされている文字列値:
none, auto, required。特定の関数を指定することもできます。boolean
デフォルト:true
モデルがツール呼び出しを並列に実行することを許可するかどうか。
object
boolean
デフォルト:true
生成されたレスポンスを後で取得するために保存するかどうか。
object
レスポンスに添付できる16個のキーと値のペアのセット。キーは最大64文字の文字列です。値は最大512文字の文字列です。
string
エンドユーザーを表す一意の識別子。最大128文字。
レスポンス
成功レスポンスオブジェクト。string
一意のレスポンス識別子。
string
オブジェクトタイプ。常に
response。number
レスポンスが作成された時のUnixタイムスタンプ(秒単位)。
string
レスポンスのステータス。可能な値:
completed, failed, in_progress, cancelled。string
レスポンス生成に使用されたモデル。
object[]
object
number
使用されたサンプリング温度。
number
使用された核サンプリング値。
integer | null
使用された最大出力トークン設定。
object | null
生成が失敗した場合のエラーオブジェクト。
curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "openai/gpt-4o",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/gpt-4o",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"status": "completed",
"model": "openai/gpt-4o",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
},
"error": null
}
⌘I