Skip to main content
POST
/
v1
/
responses
OpenAI responses
curl --request POST \
  --url https://api-vip.apigo.ai/v1/responses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-4.1",
  "input": "<string>",
  "instructions": "<string>",
  "max_output_tokens": 123
}
'
import requests

url = "https://api-vip.apigo.ai/v1/responses"

payload = {
    "model": "gpt-4.1",
    "input": "<string>",
    "instructions": "<string>",
    "max_output_tokens": 123
}
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({
    model: 'gpt-4.1',
    input: '<string>',
    instructions: '<string>',
    max_output_tokens: 123
  })
};

fetch('https://api-vip.apigo.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://api-vip.apigo.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([
    'model' => 'gpt-4.1',
    'input' => '<string>',
    'instructions' => '<string>',
    'max_output_tokens' => 123
  ]),
  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://api-vip.apigo.ai/v1/responses"

	payload := strings.NewReader("{\n  \"model\": \"gpt-4.1\",\n  \"input\": \"<string>\",\n  \"instructions\": \"<string>\",\n  \"max_output_tokens\": 123\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-vip.apigo.ai/v1/responses")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gpt-4.1\",\n  \"input\": \"<string>\",\n  \"instructions\": \"<string>\",\n  \"max_output_tokens\": 123\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api-vip.apigo.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  \"model\": \"gpt-4.1\",\n  \"input\": \"<string>\",\n  \"instructions\": \"<string>\",\n  \"max_output_tokens\": 123\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "object": "response",
  "status": "<string>",
  "output_text": "<string>",
  "output": [
    {}
  ],
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "total_tokens": 123
  }
}
{
  "error": 123,
  "message": "<string>"
}
Creates a unified response object for text generation, structured output, tool calls, and multimodal input. Compared with chat.completions, this endpoint is a better fit for new integrations because text, images, reasoning controls, and tools all share one response model. Supported fields still vary by model.

Integration guidance

  • Authenticate with Authorization: Bearer {API_KEY}
  • Prefer this endpoint when you want one surface for text, JSON output, tool calls, and future multimodal workflows
  • Use previous_response_id to continue a conversation without resending the full history
  • For reasoning-model workflows, centralize reasoning, max_output_tokens, and tools in your server-side gateway
  • Streaming clients should consume incremental events instead of waiting for one final payload

Request highlights

  • input is the primary input field and can carry text or multimodal content blocks
  • model selects the target model for the response
  • previous_response_id is the main way to chain turns across a conversation
  • For structured output, declare explicit JSON formatting requirements and validate server-side
  • For tool use, pass tools and handle tool call outputs explicitly

Response highlights

  • Simple text can often be read from output_text
  • Richer results should be read from output[]
  • Tool calls, reasoning traces, and multimodal outputs all share the same response object
  • Usage and status metadata should be read from the response object rather than inferred from text alone

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required
Example:

"gpt-4.1"

input
required
instructions
string
max_output_tokens
integer

Response

Successful responses payload

id
string
object
string
Example:

"response"

status
string
output_text
string
output
object[]
usage
object