const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-5-nano',
stream: false,
messages: [{role: 'user', content: 'What is the current datetime in Europe/London?'}],
tools: [{type: 'gateway:datetime', parameters: {timezone: 'Europe/London'}}],
tool_choice: 'auto'
})
};
fetch('https://api.phaseo.app/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/chat/completions"
payload = {
"model": "openai/gpt-5-nano",
"stream": False,
"messages": [
{
"role": "user",
"content": "What is the current datetime in Europe/London?"
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": { "timezone": "Europe/London" }
}
],
"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/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5-nano",
"stream": false,
"messages": [
{
"role": "user",
"content": "What is the current datetime in Europe/London?"
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": {
"timezone": "Europe/London"
}
}
],
"tool_choice": "auto"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the current datetime in Europe/London?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Europe/London\"\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/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the current datetime in Europe/London?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Europe/London\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/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' => 'openai/gpt-5-nano',
'stream' => false,
'messages' => [
[
'role' => 'user',
'content' => 'What is the current datetime in Europe/London?'
]
],
'tools' => [
[
'type' => 'gateway:datetime',
'parameters' => [
'timezone' => 'Europe/London'
]
]
],
'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/chat/completions")
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 \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the current datetime in Europe/London?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Europe/London\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"nativeResponseId": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"provider": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"images": [
{
"type": "image_url",
"image_url": {
"url": "<string>"
},
"mime_type": "<string>"
}
],
"audios": [
{
"type": "audio_url",
"audio_url": {
"url": "<string>"
},
"mime_type": "<string>",
"format": "wav"
}
],
"tool_call_id": "<string>"
},
"finish_reason": "stop"
}
],
"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": [
{}
]
}चैट completion बनाएँ
OpenAI-संगत chat endpoint से chat completions जनरेट करें।
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-5-nano',
stream: false,
messages: [{role: 'user', content: 'What is the current datetime in Europe/London?'}],
tools: [{type: 'gateway:datetime', parameters: {timezone: 'Europe/London'}}],
tool_choice: 'auto'
})
};
fetch('https://api.phaseo.app/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.phaseo.app/v1/chat/completions"
payload = {
"model": "openai/gpt-5-nano",
"stream": False,
"messages": [
{
"role": "user",
"content": "What is the current datetime in Europe/London?"
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": { "timezone": "Europe/London" }
}
],
"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/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-5-nano",
"stream": false,
"messages": [
{
"role": "user",
"content": "What is the current datetime in Europe/London?"
}
],
"tools": [
{
"type": "gateway:datetime",
"parameters": {
"timezone": "Europe/London"
}
}
],
"tool_choice": "auto"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phaseo.app/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the current datetime in Europe/London?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Europe/London\"\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/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-5-nano\",\n \"stream\": false,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the current datetime in Europe/London?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Europe/London\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phaseo.app/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' => 'openai/gpt-5-nano',
'stream' => false,
'messages' => [
[
'role' => 'user',
'content' => 'What is the current datetime in Europe/London?'
]
],
'tools' => [
[
'type' => 'gateway:datetime',
'parameters' => [
'timezone' => 'Europe/London'
]
]
],
'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/chat/completions")
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 \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the current datetime in Europe/London?\"\n }\n ],\n \"tools\": [\n {\n \"type\": \"gateway:datetime\",\n \"parameters\": {\n \"timezone\": \"Europe/London\"\n }\n }\n ],\n \"tool_choice\": \"auto\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"nativeResponseId": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"provider": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"images": [
{
"type": "image_url",
"image_url": {
"url": "<string>"
},
"mime_type": "<string>"
}
],
"audios": [
{
"type": "audio_url",
"audio_url": {
"url": "<string>"
},
"mime_type": "<string>",
"format": "wav"
}
],
"tool_call_id": "<string>"
},
"finish_reason": "stop"
}
],
"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/chat/completions सामान्य function tools और Gateway द्वारा प्रबंधित इन server tools को सपोर्ट करता है:
gateway:datetimephaseo:web_searchphaseo:web_fetchphaseo:advisorphaseo:image_generation
दिनांक और समय का उदाहरण
curl https://api.phaseo.app/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5-nano",
"stream": false,
"messages": [
{ "role": "user", "content": "What is the current datetime in Europe/London?" }
],
"tools": [
{
"type": "gateway:datetime",
"parameters": { "timezone": "Europe/London" }
}
],
"tool_choice": "auto"
}'
{
"usage": {
"prompt_tokens": 12,
"completion_tokens": 34,
"total_tokens": 46,
"server_tool_use": {
"datetime_requests": 1
}
}
}
phaseo:web_search से server_tool_use.web_search_requests, server_tool_use.web_search_results और server_tool_use.web_search_extra_results जुड़ते हैं। phaseo:web_fetch से server_tool_use.web_fetch_requests जुड़ता है।
स्ट्रीमिंग नोट
stream: true भी समर्थित है। Gateway-प्रबंधित server tools के लिए Phaseo upstream tool-call turn को materialize करके loop जारी रख सकता है और फिर synthetic stream दोबारा भेज सकता है।प्राधिकरण
Bearer टोकन से प्रमाणीकरण
बॉडी
1Show child attributes
Show child attributes
Show child attributes
Show child attributes
reasoning.effort के लिए OpenAI-संगत alias।
none, instant, minimal, low, medium, high, xhigh, max -2 <= x <= 2Show child attributes
Show child attributes
x >= 1x >= 1Show child attributes
Show child attributes
ऑब्ज़र्वेबिलिटी के लिए संबंधित अनुरोधों (जैसे बातचीत या एजेंट वर्कफ़्लो) को समूहित करने वाला विशिष्ट पहचानकर्ता।
256-2 <= x <= 2-9223372036854776000 <= x <= 92233720368547760000 <= x <= 2मॉडल फ़ंक्शन कॉल और गेटवे सर्वर टूल के लिए टूल परिभाषाएँ। अंतर्निहित सर्वर टूल में दिनांक-समय, वेब खोज, वेब फ़ेच, Advisor, Subagent, Fusion, मॉडल खोज, इमेज जनरेशन और पैच निर्माण शामिल हैं।
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
Show child attributes
Show child attributes
x >= 1टूल चयन रणनीति। Phaseo सर्वर-टूल प्रकार स्वीकार किए जाते हैं और upstream फ़ंक्शन/टूल लक्ष्यों में बदले जाते हैं।
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 0 <= x <= 200 <= x <= 1text, image, audio Show child attributes
Show child attributes
प्रदाता चयनकर्ता। एकल प्रदाता के लिए string या { "only": ["groq"] } जैसे रूटिंग विकल्पों का उपयोग करें।
openai, anthropic, google-ai-studio, gemini, mistral, x-ai, xai, groq, together वैकल्पिक प्रदाता-विशिष्ट विकल्प।
Show child attributes
Show child attributes
standard, default, fast, ultrafast, priority, flex, batch गेटवे डिबग नियंत्रण। ये फ़्लैग कभी भी प्रदाता को फ़ॉरवर्ड नहीं किए जाते।
Show child attributes
Show child attributes
वाज़ दिस पेज हेल्पफुल