curl --request POST \
--url https://cloud-api.near.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"include": [
"<string>"
],
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"max_tool_calls": 123,
"metadata": "<unknown>",
"parallel_tool_calls": true,
"prompt_cache_key": "<string>",
"reasoning": {
"effort": "<string>"
},
"safety_identifier": "<string>",
"service_tier": "<string>",
"store": false,
"stream": true,
"temperature": 123,
"tool_choice": "<string>",
"tools": [
{
"name": "<string>",
"type": "function",
"description": "<string>",
"parameters": "<unknown>"
}
],
"top_p": 123
}
'import requests
url = "https://cloud-api.near.ai/v1/responses"
payload = {
"model": "<string>",
"include": ["<string>"],
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"max_tool_calls": 123,
"metadata": "<unknown>",
"parallel_tool_calls": True,
"prompt_cache_key": "<string>",
"reasoning": { "effort": "<string>" },
"safety_identifier": "<string>",
"service_tier": "<string>",
"store": False,
"stream": True,
"temperature": 123,
"tool_choice": "<string>",
"tools": [
{
"name": "<string>",
"type": "function",
"description": "<string>",
"parameters": "<unknown>"
}
],
"top_p": 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: '<string>',
include: ['<string>'],
input: '<string>',
instructions: '<string>',
max_output_tokens: 123,
max_tool_calls: 123,
metadata: '<unknown>',
parallel_tool_calls: true,
prompt_cache_key: '<string>',
reasoning: {effort: '<string>'},
safety_identifier: '<string>',
service_tier: '<string>',
store: false,
stream: true,
temperature: 123,
tool_choice: '<string>',
tools: [
{
name: '<string>',
type: 'function',
description: '<string>',
parameters: '<unknown>'
}
],
top_p: 123
})
};
fetch('https://cloud-api.near.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://cloud-api.near.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' => '<string>',
'include' => [
'<string>'
],
'input' => '<string>',
'instructions' => '<string>',
'max_output_tokens' => 123,
'max_tool_calls' => 123,
'metadata' => '<unknown>',
'parallel_tool_calls' => true,
'prompt_cache_key' => '<string>',
'reasoning' => [
'effort' => '<string>'
],
'safety_identifier' => '<string>',
'service_tier' => '<string>',
'store' => false,
'stream' => true,
'temperature' => 123,
'tool_choice' => '<string>',
'tools' => [
[
'name' => '<string>',
'type' => 'function',
'description' => '<string>',
'parameters' => '<unknown>'
]
],
'top_p' => 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://cloud-api.near.ai/v1/responses"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"include\": [\n \"<string>\"\n ],\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"metadata\": \"<unknown>\",\n \"parallel_tool_calls\": true,\n \"prompt_cache_key\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"<string>\"\n },\n \"safety_identifier\": \"<string>\",\n \"service_tier\": \"<string>\",\n \"store\": false,\n \"stream\": true,\n \"temperature\": 123,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"type\": \"function\",\n \"description\": \"<string>\",\n \"parameters\": \"<unknown>\"\n }\n ],\n \"top_p\": 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://cloud-api.near.ai/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"include\": [\n \"<string>\"\n ],\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"metadata\": \"<unknown>\",\n \"parallel_tool_calls\": true,\n \"prompt_cache_key\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"<string>\"\n },\n \"safety_identifier\": \"<string>\",\n \"service_tier\": \"<string>\",\n \"store\": false,\n \"stream\": true,\n \"temperature\": 123,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"type\": \"function\",\n \"description\": \"<string>\",\n \"parameters\": \"<unknown>\"\n }\n ],\n \"top_p\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.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\": \"<string>\",\n \"include\": [\n \"<string>\"\n ],\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"metadata\": \"<unknown>\",\n \"parallel_tool_calls\": true,\n \"prompt_cache_key\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"<string>\"\n },\n \"safety_identifier\": \"<string>\",\n \"service_tier\": \"<string>\",\n \"store\": false,\n \"stream\": true,\n \"temperature\": 123,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"type\": \"function\",\n \"description\": \"<string>\",\n \"parameters\": \"<unknown>\"\n }\n ],\n \"top_p\": 123\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"output": [
{
"content": [
{
"text": "<string>",
"type": "input_text"
}
],
"id": "<string>",
"model": "<string>",
"role": "<string>",
"status": "completed",
"type": "message",
"created_at": 123,
"metadata": "<unknown>",
"next_response_ids": [
"<string>"
],
"previous_response_id": "<string>",
"response_id": "<string>"
}
],
"parallel_tool_calls": true,
"status": "completed",
"store": true,
"temperature": 123,
"tool_choice": "<string>",
"tools": [
{
"name": "<string>",
"type": "function",
"description": "<string>",
"parameters": "<unknown>"
}
],
"top_p": 123,
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens_details": {
"reasoning_tokens": 123
}
},
"background": true,
"conversation": {
"id": "<string>"
},
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"incomplete_details": {
"reason": "<string>"
},
"instructions": "<string>",
"max_output_tokens": 123,
"max_tool_calls": 123,
"metadata": "<unknown>",
"next_response_ids": [
"<string>"
],
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"prompt_cache_retention": "<string>",
"reasoning": {
"effort": "<string>",
"summary": "<string>"
},
"safety_identifier": "<string>",
"service_tier": "<string>",
"top_logprobs": 123,
"truncation": "<string>",
"user": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Create response
Generate a single-turn, stateless AI response with optional streaming.
curl --request POST \
--url https://cloud-api.near.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"include": [
"<string>"
],
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"max_tool_calls": 123,
"metadata": "<unknown>",
"parallel_tool_calls": true,
"prompt_cache_key": "<string>",
"reasoning": {
"effort": "<string>"
},
"safety_identifier": "<string>",
"service_tier": "<string>",
"store": false,
"stream": true,
"temperature": 123,
"tool_choice": "<string>",
"tools": [
{
"name": "<string>",
"type": "function",
"description": "<string>",
"parameters": "<unknown>"
}
],
"top_p": 123
}
'import requests
url = "https://cloud-api.near.ai/v1/responses"
payload = {
"model": "<string>",
"include": ["<string>"],
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"max_tool_calls": 123,
"metadata": "<unknown>",
"parallel_tool_calls": True,
"prompt_cache_key": "<string>",
"reasoning": { "effort": "<string>" },
"safety_identifier": "<string>",
"service_tier": "<string>",
"store": False,
"stream": True,
"temperature": 123,
"tool_choice": "<string>",
"tools": [
{
"name": "<string>",
"type": "function",
"description": "<string>",
"parameters": "<unknown>"
}
],
"top_p": 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: '<string>',
include: ['<string>'],
input: '<string>',
instructions: '<string>',
max_output_tokens: 123,
max_tool_calls: 123,
metadata: '<unknown>',
parallel_tool_calls: true,
prompt_cache_key: '<string>',
reasoning: {effort: '<string>'},
safety_identifier: '<string>',
service_tier: '<string>',
store: false,
stream: true,
temperature: 123,
tool_choice: '<string>',
tools: [
{
name: '<string>',
type: 'function',
description: '<string>',
parameters: '<unknown>'
}
],
top_p: 123
})
};
fetch('https://cloud-api.near.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://cloud-api.near.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' => '<string>',
'include' => [
'<string>'
],
'input' => '<string>',
'instructions' => '<string>',
'max_output_tokens' => 123,
'max_tool_calls' => 123,
'metadata' => '<unknown>',
'parallel_tool_calls' => true,
'prompt_cache_key' => '<string>',
'reasoning' => [
'effort' => '<string>'
],
'safety_identifier' => '<string>',
'service_tier' => '<string>',
'store' => false,
'stream' => true,
'temperature' => 123,
'tool_choice' => '<string>',
'tools' => [
[
'name' => '<string>',
'type' => 'function',
'description' => '<string>',
'parameters' => '<unknown>'
]
],
'top_p' => 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://cloud-api.near.ai/v1/responses"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"include\": [\n \"<string>\"\n ],\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"metadata\": \"<unknown>\",\n \"parallel_tool_calls\": true,\n \"prompt_cache_key\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"<string>\"\n },\n \"safety_identifier\": \"<string>\",\n \"service_tier\": \"<string>\",\n \"store\": false,\n \"stream\": true,\n \"temperature\": 123,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"type\": \"function\",\n \"description\": \"<string>\",\n \"parameters\": \"<unknown>\"\n }\n ],\n \"top_p\": 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://cloud-api.near.ai/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"include\": [\n \"<string>\"\n ],\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"metadata\": \"<unknown>\",\n \"parallel_tool_calls\": true,\n \"prompt_cache_key\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"<string>\"\n },\n \"safety_identifier\": \"<string>\",\n \"service_tier\": \"<string>\",\n \"store\": false,\n \"stream\": true,\n \"temperature\": 123,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"type\": \"function\",\n \"description\": \"<string>\",\n \"parameters\": \"<unknown>\"\n }\n ],\n \"top_p\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.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\": \"<string>\",\n \"include\": [\n \"<string>\"\n ],\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"metadata\": \"<unknown>\",\n \"parallel_tool_calls\": true,\n \"prompt_cache_key\": \"<string>\",\n \"reasoning\": {\n \"effort\": \"<string>\"\n },\n \"safety_identifier\": \"<string>\",\n \"service_tier\": \"<string>\",\n \"store\": false,\n \"stream\": true,\n \"temperature\": 123,\n \"tool_choice\": \"<string>\",\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"type\": \"function\",\n \"description\": \"<string>\",\n \"parameters\": \"<unknown>\"\n }\n ],\n \"top_p\": 123\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"output": [
{
"content": [
{
"text": "<string>",
"type": "input_text"
}
],
"id": "<string>",
"model": "<string>",
"role": "<string>",
"status": "completed",
"type": "message",
"created_at": 123,
"metadata": "<unknown>",
"next_response_ids": [
"<string>"
],
"previous_response_id": "<string>",
"response_id": "<string>"
}
],
"parallel_tool_calls": true,
"status": "completed",
"store": true,
"temperature": 123,
"tool_choice": "<string>",
"tools": [
{
"name": "<string>",
"type": "function",
"description": "<string>",
"parameters": "<unknown>"
}
],
"top_p": 123,
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens_details": {
"reasoning_tokens": 123
}
},
"background": true,
"conversation": {
"id": "<string>"
},
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
},
"incomplete_details": {
"reason": "<string>"
},
"instructions": "<string>",
"max_output_tokens": 123,
"max_tool_calls": 123,
"metadata": "<unknown>",
"next_response_ids": [
"<string>"
],
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"prompt_cache_retention": "<string>",
"reasoning": {
"effort": "<string>",
"summary": "<string>"
},
"safety_identifier": "<string>",
"service_tier": "<string>",
"top_logprobs": 123,
"truncation": "<string>",
"user": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
API key for programmatic access (Authorization: Bearer sk-<api_key>)
Body
OpenAPI-only view of the stateless Responses request contract.
The runtime request type keeps legacy variants so it can return a precise
invalid_request_error for them. The public endpoint schema should instead
show only the items accepted by the stateless implementation.
Reasoning configuration
Show child attributes
Show child attributes
Must be false when supplied; omitted is normalized to false.
false
Tool choice configuration
Show child attributes
Show child attributes
Response
Response created
Complete response object
Output item from response
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
Show child attributes
Show child attributes
completed, failed, in_progress, cancelled, queued, incomplete Show child attributes
Show child attributes
Show child attributes
Show child attributes
Conversation reference in response object
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes