cURL
curl --request POST \
--url https://aigw.portkey.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"metadata": {},
"temperature": 1,
"top_p": 1,
"user": "<string>",
"previous_response_id": "<string>",
"reasoning": {
"effort": "medium"
},
"max_output_tokens": 123,
"instructions": "<string>",
"text": {
"format": {
"type": "text"
}
},
"tools": [
{
"type": "file_search",
"vector_store_ids": [
"<string>"
],
"max_num_results": 123,
"filters": {
"type": "eq",
"key": "<string>",
"value": "<string>"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
],
"truncation": "disabled",
"include": [],
"parallel_tool_calls": true,
"store": true,
"stream": false
}
'import requests
url = "https://aigw.portkey.ai/v1/responses"
payload = {
"input": "<string>",
"metadata": {},
"temperature": 1,
"top_p": 1,
"user": "<string>",
"previous_response_id": "<string>",
"reasoning": { "effort": "medium" },
"max_output_tokens": 123,
"instructions": "<string>",
"text": { "format": { "type": "text" } },
"tools": [
{
"type": "file_search",
"vector_store_ids": ["<string>"],
"max_num_results": 123,
"filters": {
"type": "eq",
"key": "<string>",
"value": "<string>"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
],
"truncation": "disabled",
"include": [],
"parallel_tool_calls": True,
"store": True,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: '<string>',
metadata: {},
temperature: 1,
top_p: 1,
user: '<string>',
previous_response_id: '<string>',
reasoning: {effort: 'medium'},
max_output_tokens: 123,
instructions: '<string>',
text: {format: {type: 'text'}},
tools: [
{
type: 'file_search',
vector_store_ids: ['<string>'],
max_num_results: 123,
filters: {type: 'eq', key: '<string>', value: '<string>'},
ranking_options: {ranker: 'auto', score_threshold: 0}
}
],
truncation: 'disabled',
include: [],
parallel_tool_calls: true,
store: true,
stream: false
})
};
fetch('https://aigw.portkey.ai/v1/responses', 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://aigw.portkey.ai/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([
'input' => '<string>',
'metadata' => [
],
'temperature' => 1,
'top_p' => 1,
'user' => '<string>',
'previous_response_id' => '<string>',
'reasoning' => [
'effort' => 'medium'
],
'max_output_tokens' => 123,
'instructions' => '<string>',
'text' => [
'format' => [
'type' => 'text'
]
],
'tools' => [
[
'type' => 'file_search',
'vector_store_ids' => [
'<string>'
],
'max_num_results' => 123,
'filters' => [
'type' => 'eq',
'key' => '<string>',
'value' => '<string>'
],
'ranking_options' => [
'ranker' => 'auto',
'score_threshold' => 0
]
]
],
'truncation' => 'disabled',
'include' => [
],
'parallel_tool_calls' => true,
'store' => true,
'stream' => false
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://aigw.portkey.ai/v1/responses"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"metadata\": {},\n \"temperature\": 1,\n \"top_p\": 1,\n \"user\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"medium\"\n },\n \"max_output_tokens\": 123,\n \"instructions\": \"<string>\",\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"vector_store_ids\": [\n \"<string>\"\n ],\n \"max_num_results\": 123,\n \"filters\": {\n \"type\": \"eq\",\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0\n }\n }\n ],\n \"truncation\": \"disabled\",\n \"include\": [],\n \"parallel_tool_calls\": true,\n \"store\": true,\n \"stream\": false\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://aigw.portkey.ai/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\",\n \"metadata\": {},\n \"temperature\": 1,\n \"top_p\": 1,\n \"user\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"medium\"\n },\n \"max_output_tokens\": 123,\n \"instructions\": \"<string>\",\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"vector_store_ids\": [\n \"<string>\"\n ],\n \"max_num_results\": 123,\n \"filters\": {\n \"type\": \"eq\",\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0\n }\n }\n ],\n \"truncation\": \"disabled\",\n \"include\": [],\n \"parallel_tool_calls\": true,\n \"store\": true,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://aigw.portkey.ai/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 \"input\": \"<string>\",\n \"metadata\": {},\n \"temperature\": 1,\n \"top_p\": 1,\n \"user\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"medium\"\n },\n \"max_output_tokens\": 123,\n \"instructions\": \"<string>\",\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"vector_store_ids\": [\n \"<string>\"\n ],\n \"max_num_results\": 123,\n \"filters\": {\n \"type\": \"eq\",\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0\n }\n }\n ],\n \"truncation\": \"disabled\",\n \"include\": [],\n \"parallel_tool_calls\": true,\n \"store\": true,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"metadata": {},
"temperature": 1,
"top_p": 1,
"model": "o1-pro",
"instructions": "<string>",
"tools": [
{
"type": "file_search",
"vector_store_ids": [
"<string>"
],
"max_num_results": 123,
"filters": {
"type": "eq",
"key": "<string>",
"value": "<string>"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
],
"tool_choice": "none",
"id": "<string>",
"object": "response",
"created_at": 123,
"error": {
"code": "server_error",
"message": "<string>"
},
"incomplete_details": {
"reason": "max_output_tokens"
},
"output": [
{
"id": "<string>",
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
{
"type": "file_citation",
"index": 123,
"file_id": "<string>"
}
]
}
],
"status": "in_progress"
}
],
"parallel_tool_calls": true,
"user": "<string>",
"previous_response_id": "<string>",
"reasoning": {
"effort": "medium",
"generate_summary": "concise"
},
"max_output_tokens": 123,
"text": {
"format": {
"type": "text"
}
},
"truncation": "disabled",
"status": "completed",
"output_text": "<string>",
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens": 123,
"output_tokens_details": {
"reasoning_tokens": 123
},
"total_tokens": 123
}
}POST
/
responses
cURL
curl --request POST \
--url https://aigw.portkey.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"metadata": {},
"temperature": 1,
"top_p": 1,
"user": "<string>",
"previous_response_id": "<string>",
"reasoning": {
"effort": "medium"
},
"max_output_tokens": 123,
"instructions": "<string>",
"text": {
"format": {
"type": "text"
}
},
"tools": [
{
"type": "file_search",
"vector_store_ids": [
"<string>"
],
"max_num_results": 123,
"filters": {
"type": "eq",
"key": "<string>",
"value": "<string>"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
],
"truncation": "disabled",
"include": [],
"parallel_tool_calls": true,
"store": true,
"stream": false
}
'import requests
url = "https://aigw.portkey.ai/v1/responses"
payload = {
"input": "<string>",
"metadata": {},
"temperature": 1,
"top_p": 1,
"user": "<string>",
"previous_response_id": "<string>",
"reasoning": { "effort": "medium" },
"max_output_tokens": 123,
"instructions": "<string>",
"text": { "format": { "type": "text" } },
"tools": [
{
"type": "file_search",
"vector_store_ids": ["<string>"],
"max_num_results": 123,
"filters": {
"type": "eq",
"key": "<string>",
"value": "<string>"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
],
"truncation": "disabled",
"include": [],
"parallel_tool_calls": True,
"store": True,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: '<string>',
metadata: {},
temperature: 1,
top_p: 1,
user: '<string>',
previous_response_id: '<string>',
reasoning: {effort: 'medium'},
max_output_tokens: 123,
instructions: '<string>',
text: {format: {type: 'text'}},
tools: [
{
type: 'file_search',
vector_store_ids: ['<string>'],
max_num_results: 123,
filters: {type: 'eq', key: '<string>', value: '<string>'},
ranking_options: {ranker: 'auto', score_threshold: 0}
}
],
truncation: 'disabled',
include: [],
parallel_tool_calls: true,
store: true,
stream: false
})
};
fetch('https://aigw.portkey.ai/v1/responses', 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://aigw.portkey.ai/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([
'input' => '<string>',
'metadata' => [
],
'temperature' => 1,
'top_p' => 1,
'user' => '<string>',
'previous_response_id' => '<string>',
'reasoning' => [
'effort' => 'medium'
],
'max_output_tokens' => 123,
'instructions' => '<string>',
'text' => [
'format' => [
'type' => 'text'
]
],
'tools' => [
[
'type' => 'file_search',
'vector_store_ids' => [
'<string>'
],
'max_num_results' => 123,
'filters' => [
'type' => 'eq',
'key' => '<string>',
'value' => '<string>'
],
'ranking_options' => [
'ranker' => 'auto',
'score_threshold' => 0
]
]
],
'truncation' => 'disabled',
'include' => [
],
'parallel_tool_calls' => true,
'store' => true,
'stream' => false
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://aigw.portkey.ai/v1/responses"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"metadata\": {},\n \"temperature\": 1,\n \"top_p\": 1,\n \"user\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"medium\"\n },\n \"max_output_tokens\": 123,\n \"instructions\": \"<string>\",\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"vector_store_ids\": [\n \"<string>\"\n ],\n \"max_num_results\": 123,\n \"filters\": {\n \"type\": \"eq\",\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0\n }\n }\n ],\n \"truncation\": \"disabled\",\n \"include\": [],\n \"parallel_tool_calls\": true,\n \"store\": true,\n \"stream\": false\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://aigw.portkey.ai/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\",\n \"metadata\": {},\n \"temperature\": 1,\n \"top_p\": 1,\n \"user\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"medium\"\n },\n \"max_output_tokens\": 123,\n \"instructions\": \"<string>\",\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"vector_store_ids\": [\n \"<string>\"\n ],\n \"max_num_results\": 123,\n \"filters\": {\n \"type\": \"eq\",\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0\n }\n }\n ],\n \"truncation\": \"disabled\",\n \"include\": [],\n \"parallel_tool_calls\": true,\n \"store\": true,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://aigw.portkey.ai/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 \"input\": \"<string>\",\n \"metadata\": {},\n \"temperature\": 1,\n \"top_p\": 1,\n \"user\": \"<string>\",\n \"previous_response_id\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"medium\"\n },\n \"max_output_tokens\": 123,\n \"instructions\": \"<string>\",\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tools\": [\n {\n \"type\": \"file_search\",\n \"vector_store_ids\": [\n \"<string>\"\n ],\n \"max_num_results\": 123,\n \"filters\": {\n \"type\": \"eq\",\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n },\n \"ranking_options\": {\n \"ranker\": \"auto\",\n \"score_threshold\": 0\n }\n }\n ],\n \"truncation\": \"disabled\",\n \"include\": [],\n \"parallel_tool_calls\": true,\n \"store\": true,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"metadata": {},
"temperature": 1,
"top_p": 1,
"model": "o1-pro",
"instructions": "<string>",
"tools": [
{
"type": "file_search",
"vector_store_ids": [
"<string>"
],
"max_num_results": 123,
"filters": {
"type": "eq",
"key": "<string>",
"value": "<string>"
},
"ranking_options": {
"ranker": "auto",
"score_threshold": 0
}
}
],
"tool_choice": "none",
"id": "<string>",
"object": "response",
"created_at": 123,
"error": {
"code": "server_error",
"message": "<string>"
},
"incomplete_details": {
"reason": "max_output_tokens"
},
"output": [
{
"id": "<string>",
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
{
"type": "file_citation",
"index": 123,
"file_id": "<string>"
}
]
}
],
"status": "in_progress"
}
],
"parallel_tool_calls": true,
"user": "<string>",
"previous_response_id": "<string>",
"reasoning": {
"effort": "medium",
"generate_summary": "concise"
},
"max_output_tokens": 123,
"text": {
"format": {
"type": "text"
}
},
"truncation": "disabled",
"status": "completed",
"output_text": "<string>",
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens": 123,
"output_tokens_details": {
"reasoning_tokens": 123
},
"total_tokens": 123
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Available options:
o1-pro, o1-pro-2025-03-19, computer-use-preview, computer-use-preview-2025-03-11 input
stringInput message · object · Input message · object · Output message · object · File search tool call · object · Computer tool call · object · Computer tool call output · object · Web search tool call · object · Function tool call · object · Function tool call output · object · Reasoning · object · Item reference · object[]
required
Show child attributes
Show child attributes
Required range:
0 <= x <= 2Required range:
0 <= x <= 1Show child attributes
Show child attributes
Show child attributes
Show child attributes
- File search
- Function
- Computer use
- Web search
Show child attributes
Show child attributes
Available options:
none, auto, required Available options:
auto, disabled Available options:
file_search_call.results, message.input_image.image_url, computer_call_output.output.image_url Response
Show child attributes
Show child attributes
Required range:
0 <= x <= 2Required range:
0 <= x <= 1Available options:
o1-pro, o1-pro-2025-03-19, computer-use-preview, computer-use-preview-2025-03-11 tools
(File search · object | Function · object | Computer use · object | Web search · object)[]
required
- File search
- Function
- Computer use
- Web search
Show child attributes
Show child attributes
Available options:
none, auto, required Available options:
response Show child attributes
Show child attributes
Show child attributes
Show child attributes
output
(Output message · object | File search tool call · object | Function tool call · object | Web search tool call · object | Computer tool call · object | Reasoning · object)[]
required
- Output message
- File search tool call
- Function tool call
- Web search tool call
- Computer tool call
- Reasoning
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
auto, disabled Available options:
completed, failed, in_progress, incomplete Show child attributes
Show child attributes
Last modified on September 17, 2026
Was this page helpful?

