応答を作成
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-5-nano',
stream: false,
input: [{role: 'user', content: 'Give me the current datetime in Asia/Tokyo.'}],
tools: [{type: 'gateway:datetime', parameters: {timezone: 'Asia/Tokyo'}}],
tool_choice: 'auto'
})
};
fetch('https://api.phaseo.app/v1/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/responses"
payload = {
"model": "openai/gpt-5-nano",
"stream": False,
"input": [
{
"role": "user",
"content": "Give me the current datetime in Asia/Tokyo."
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": { "timezone": "Asia/Tokyo" }
}
],
"tool_choice": "auto"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.phaseo.app/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5-nano",
"stream": false,
"input": [
{
"role": "user",
"content": "Give me the current datetime in Asia/Tokyo."
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": {
"timezone": "Asia/Tokyo"
}
}
],
"tool_choice": "auto"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/responses"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me the current datetime in Asia/Tokyo.\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Asia/Tokyo\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.phaseo.app/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me the current datetime in Asia/Tokyo.\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Asia/Tokyo\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/responses",
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' => 'openai/gpt-5-nano',
'stream' => false,
'input' => [
[
'role' => 'user',
'content' => 'Give me the current datetime in Asia/Tokyo.'
]
],
'tools' => [
[
'type' => 'gateway:datetime',
'parameters' => [
'timezone' => 'Asia/Tokyo'
]
]
],
'tool_choice' => 'auto'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me the current datetime in Asia/Tokyo.\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Asia/Tokyo\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"provider": "<string>",
"provider_id": "<string>",
"nativeResponseId": "<string>",
"status": "completed",
"finish_reason": "<string>",
"meta": {},
"cost_nanos": 123,
"cost_cents": 123,
"currency": "<string>",
"pricing_lines": [
{}
],
"output": [
{
"type": "<string>",
"role": "<string>",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
{}
]
}
],
"call_id": "<string>",
"name": "<string>",
"arguments": "<string>"
}
],
"output_items": [
{
"type": "<string>",
"role": "<string>",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
{}
]
}
],
"call_id": "<string>",
"name": "<string>",
"arguments": "<string>"
}
],
"content": [
{}
],
"role": "<string>",
"stop_reason": "<string>",
"type": "<string>",
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"server_tool_use": {
"datetime_requests": 1,
"web_search_requests": 1,
"subagent_requests": 1,
"fusion_requests": 1,
"search_models_requests": 1,
"web_fetch_requests": 1,
"advisor_requests": 1,
"image_generation_requests": 1,
"apply_patch_requests": 1
}
}
}{
"error": "error_type",
"ok": false,
"message": "Human-readable error message",
"description": "Additional error details.",
"generation_id": "G-abc123",
"status_code": 502,
"error_type": "system",
"error_origin": "upstream",
"reason": "all_candidates_failed",
"attempt_count": 2,
"failed_providers": [
"google-ai-studio",
"openai"
],
"failed_statuses": [
403,
429
],
"upstream_error": {
"code": "PERMISSION_DENIED",
"message": "The caller does not have permission.",
"description": "<string>",
"param": "<string>"
},
"failure_sample": [
{
"provider": "<string>",
"type": "<string>",
"status": 123,
"upstream_error_code": "<string>",
"upstream_error_message": "<string>",
"upstream_error_description": "<string>",
"upstream_error_param": "<string>",
"upstream_payload_preview": "<string>",
"retryable": true
}
],
"provider_failure_diagnostics": {
"category": "credentials_not_configured",
"hint": "<string>",
"provider": "<string>"
},
"routing_diagnostics": {
"filterStages": [
{
"stage": "<string>",
"beforeCount": 123,
"afterCount": 123,
"droppedProviders": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
}
]
},
"provider_candidate_diagnostics": {
"totalProviders": 123,
"supportsEndpointCount": 123,
"candidateCount": 123,
"droppedUnsupportedEndpoint": [
"<string>"
],
"droppedMissingAdapter": [
{
"providerId": "<string>",
"endpoint": "<string>"
}
]
},
"provider_enablement": {
"capability": "<string>",
"providersBefore": [
"<string>"
],
"providersAfter": [
"<string>"
],
"dropped": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
},
"missing_pricing_providers": [
"<string>"
],
"provider_payment_required_provider": "openai",
"provider_payment_required_support_notice": "Our upstream provider billing appears to be unavailable. If this persists, contact support.",
"details": [
{}
]
}Responses API
応答を作成
Responses API を使用して応答を作成します。
POST
/
responses
応答を作成
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-5-nano',
stream: false,
input: [{role: 'user', content: 'Give me the current datetime in Asia/Tokyo.'}],
tools: [{type: 'gateway:datetime', parameters: {timezone: 'Asia/Tokyo'}}],
tool_choice: 'auto'
})
};
fetch('https://api.phaseo.app/v1/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/responses"
payload = {
"model": "openai/gpt-5-nano",
"stream": False,
"input": [
{
"role": "user",
"content": "Give me the current datetime in Asia/Tokyo."
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": { "timezone": "Asia/Tokyo" }
}
],
"tool_choice": "auto"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.phaseo.app/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5-nano",
"stream": false,
"input": [
{
"role": "user",
"content": "Give me the current datetime in Asia/Tokyo."
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": {
"timezone": "Asia/Tokyo"
}
}
],
"tool_choice": "auto"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/responses"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me the current datetime in Asia/Tokyo.\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Asia/Tokyo\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.phaseo.app/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me the current datetime in Asia/Tokyo.\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Asia/Tokyo\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/v1/responses",
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' => 'openai/gpt-5-nano',
'stream' => false,
'input' => [
[
'role' => 'user',
'content' => 'Give me the current datetime in Asia/Tokyo.'
]
],
'tools' => [
[
'type' => 'gateway:datetime',
'parameters' => [
'timezone' => 'Asia/Tokyo'
]
]
],
'tool_choice' => 'auto'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.phaseo.app/v1/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"Give me the current datetime in Asia/Tokyo.\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Asia/Tokyo\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"provider": "<string>",
"provider_id": "<string>",
"nativeResponseId": "<string>",
"status": "completed",
"finish_reason": "<string>",
"meta": {},
"cost_nanos": 123,
"cost_cents": 123,
"currency": "<string>",
"pricing_lines": [
{}
],
"output": [
{
"type": "<string>",
"role": "<string>",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
{}
]
}
],
"call_id": "<string>",
"name": "<string>",
"arguments": "<string>"
}
],
"output_items": [
{
"type": "<string>",
"role": "<string>",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
{}
]
}
],
"call_id": "<string>",
"name": "<string>",
"arguments": "<string>"
}
],
"content": [
{}
],
"role": "<string>",
"stop_reason": "<string>",
"type": "<string>",
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"server_tool_use": {
"datetime_requests": 1,
"web_search_requests": 1,
"subagent_requests": 1,
"fusion_requests": 1,
"search_models_requests": 1,
"web_fetch_requests": 1,
"advisor_requests": 1,
"image_generation_requests": 1,
"apply_patch_requests": 1
}
}
}{
"error": "error_type",
"ok": false,
"message": "Human-readable error message",
"description": "Additional error details.",
"generation_id": "G-abc123",
"status_code": 502,
"error_type": "system",
"error_origin": "upstream",
"reason": "all_candidates_failed",
"attempt_count": 2,
"failed_providers": [
"google-ai-studio",
"openai"
],
"failed_statuses": [
403,
429
],
"upstream_error": {
"code": "PERMISSION_DENIED",
"message": "The caller does not have permission.",
"description": "<string>",
"param": "<string>"
},
"failure_sample": [
{
"provider": "<string>",
"type": "<string>",
"status": 123,
"upstream_error_code": "<string>",
"upstream_error_message": "<string>",
"upstream_error_description": "<string>",
"upstream_error_param": "<string>",
"upstream_payload_preview": "<string>",
"retryable": true
}
],
"provider_failure_diagnostics": {
"category": "credentials_not_configured",
"hint": "<string>",
"provider": "<string>"
},
"routing_diagnostics": {
"filterStages": [
{
"stage": "<string>",
"beforeCount": 123,
"afterCount": 123,
"droppedProviders": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
}
]
},
"provider_candidate_diagnostics": {
"totalProviders": 123,
"supportsEndpointCount": 123,
"candidateCount": 123,
"droppedUnsupportedEndpoint": [
"<string>"
],
"droppedMissingAdapter": [
{
"providerId": "<string>",
"endpoint": "<string>"
}
]
},
"provider_enablement": {
"capability": "<string>",
"providersBefore": [
"<string>"
],
"providersAfter": [
"<string>"
],
"dropped": [
{
"providerId": "<string>",
"reason": "<string>"
}
]
},
"missing_pricing_providers": [
"<string>"
],
"provider_payment_required_provider": "openai",
"provider_payment_required_support_notice": "Our upstream provider billing appears to be unavailable. If this persists, contact support.",
"details": [
{}
]
}サーバーツール
/v1/responses は通常の関数ツールに加え、次の Gateway 管理サーバーツールに対応しています。
gateway:datetimephaseo:web_searchphaseo:web_fetchphaseo:advisorphaseo:image_generationphaseo:apply_patch
日時の例
curl https://api.phaseo.app/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5-nano",
"stream": false,
"input": [
{ "role": "user", "content": "Give me the current datetime in Asia/Tokyo." }
],
"tools": [
{
"type": "gateway:datetime",
"parameters": { "timezone": "Asia/Tokyo" }
}
],
"tool_choice": "auto"
}'
usage.server_tool_use.* カウンターが含まれます。
gateway:datetime->datetime_requestsphaseo:web_search->web_search_requests,web_search_results,web_search_extra_resultsphaseo:web_fetch->web_fetch_requestsphaseo:advisor->advisor_requestsphaseo:image_generation->image_generation_requestsphaseo:apply_patch->apply_patch_requests
ストリーミングに関する注意
stream: true にも対応しています。Gateway 管理サーバーツールでは、Phaseo が上流のツール呼び出しターンを処理し、ループを続行した後に合成ストリームを再送する場合があります。承認
Bearer トークンによる認証
ボディ
application/json
必須範囲:
x >= 1Show child attributes
Show child attributes
関連するリクエスト(会話やエージェントのワークフローなど)を可観測性のためにまとめる一意の識別子です。
Maximum string length:
256Show child attributes
Show child attributes
利用可能なオプション:
standard, default, fast, ultrafast, priority, flex, batch 必須範囲:
0 <= x <= 2ツール選択の方法です。Phaseo サーバーツールのタイプを受け付け、上流の関数またはツールの指定に変換します。
利用可能なオプション:
auto, none, required, phaseo:datetime, phaseo:web_search, phaseo:web_fetch, phaseo:subagent, phaseo:fusion, phaseo:search_models, gateway:datetime, gateway:web_search, gateway:web_fetch モデルの関数呼び出しとゲートウェイのサーバーツールのツール定義です。ゲートウェイの組み込みサーバーツールは gateway:datetime、gateway:web_search、gateway:web_fetch です。
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
Show child attributes
Show child attributes
必須範囲:
0 <= x <= 1利用可能なオプション:
auto, disabled 利用可能なオプション:
text, image, audio Show child attributes
Show child attributes
任意のプロバイダー固有オプションです。
Show child attributes
Show child attributes
ゲートウェイのデバッグ設定です。これらのフラグがプロバイダーに転送されることはありません。
Show child attributes
Show child attributes
ゲートウェイでの選択に使用するプロバイダーのルーティング設定。
Show child attributes
Show child attributes
レスポンス
応答
利用可能なオプション:
completed, failed, incomplete Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
最終更新日 2026年10月2日