curl --request POST \
--url https://api.haitoken.ai/v1/responses \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "<string>",
"context_management": [
{
"compact_threshold": 123,
"type": "<string>"
}
],
"max_output_tokens": 123,
"max_tool_calls": 123,
"parallel_tool_calls": true,
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"safety_identifier": "<string>",
"stream_options": {
"include_obfuscation": true
},
"top_logprobs": 123,
"top_p": 123,
"background": true,
"conversation": {},
"include": [
"<string>"
],
"instructions": "<string>",
"metadata": {
"metadata": "new java.util.HashMap<>()"
},
"moderation": {
"input": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"output": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
}
},
"reasoning": {},
"store": false,
"stream": false,
"temperature": 123,
"text": {
"format": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
},
"verbosity": "<string>"
},
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true,
"defer_loading": true
}
],
"user": "<string>"
}
'import requests
url = "https://api.haitoken.ai/v1/responses"
payload = {
"input": "<string>",
"model": "<string>",
"context_management": [
{
"compact_threshold": 123,
"type": "<string>"
}
],
"max_output_tokens": 123,
"max_tool_calls": 123,
"parallel_tool_calls": True,
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"safety_identifier": "<string>",
"stream_options": { "include_obfuscation": True },
"top_logprobs": 123,
"top_p": 123,
"background": True,
"conversation": {},
"include": ["<string>"],
"instructions": "<string>",
"metadata": { "metadata": "new java.util.HashMap<>()" },
"moderation": {
"input": {
"category_applied_input_types": { "key": {} },
"category_scores": { "key": {} },
"categories": { "key": {} },
"flagged": True,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"output": {
"category_applied_input_types": { "key": {} },
"category_scores": { "key": {} },
"categories": { "key": {} },
"flagged": True,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
}
},
"reasoning": {},
"store": False,
"stream": False,
"temperature": 123,
"text": {
"format": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": True
},
"verbosity": "<string>"
},
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": True,
"defer_loading": True
}
],
"user": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: '<string>',
model: '<string>',
context_management: [{compact_threshold: 123, type: '<string>'}],
max_output_tokens: 123,
max_tool_calls: 123,
parallel_tool_calls: true,
previous_response_id: '<string>',
prompt_cache_key: '<string>',
safety_identifier: '<string>',
stream_options: {include_obfuscation: true},
top_logprobs: 123,
top_p: 123,
background: true,
conversation: {},
include: ['<string>'],
instructions: '<string>',
metadata: {metadata: 'new java.util.HashMap<>()'},
moderation: {
input: {
category_applied_input_types: {key: {}},
category_scores: {key: {}},
categories: {key: {}},
flagged: true,
model: '<string>',
type: '<string>',
code: '<string>',
message: '<string>'
},
output: {
category_applied_input_types: {key: {}},
category_scores: {key: {}},
categories: {key: {}},
flagged: true,
model: '<string>',
type: '<string>',
code: '<string>',
message: '<string>'
}
},
reasoning: {},
store: false,
stream: false,
temperature: 123,
text: {
format: {name: '<string>', description: '<string>', schema: {}, strict: true},
verbosity: '<string>'
},
tools: [
{
type: 'function',
name: '<string>',
description: '<string>',
parameters: {},
strict: true,
defer_loading: true
}
],
user: '<string>'
})
};
fetch('https://api.haitoken.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.haitoken.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>',
'model' => '<string>',
'context_management' => [
[
'compact_threshold' => 123,
'type' => '<string>'
]
],
'max_output_tokens' => 123,
'max_tool_calls' => 123,
'parallel_tool_calls' => true,
'previous_response_id' => '<string>',
'prompt_cache_key' => '<string>',
'safety_identifier' => '<string>',
'stream_options' => [
'include_obfuscation' => true
],
'top_logprobs' => 123,
'top_p' => 123,
'background' => true,
'conversation' => [
],
'include' => [
'<string>'
],
'instructions' => '<string>',
'metadata' => [
'metadata' => 'new java.util.HashMap<>()'
],
'moderation' => [
'input' => [
'category_applied_input_types' => [
'key' => [
]
],
'category_scores' => [
'key' => [
]
],
'categories' => [
'key' => [
]
],
'flagged' => true,
'model' => '<string>',
'type' => '<string>',
'code' => '<string>',
'message' => '<string>'
],
'output' => [
'category_applied_input_types' => [
'key' => [
]
],
'category_scores' => [
'key' => [
]
],
'categories' => [
'key' => [
]
],
'flagged' => true,
'model' => '<string>',
'type' => '<string>',
'code' => '<string>',
'message' => '<string>'
]
],
'reasoning' => [
],
'store' => false,
'stream' => false,
'temperature' => 123,
'text' => [
'format' => [
'name' => '<string>',
'description' => '<string>',
'schema' => [
],
'strict' => true
],
'verbosity' => '<string>'
],
'tools' => [
[
'type' => 'function',
'name' => '<string>',
'description' => '<string>',
'parameters' => [
],
'strict' => true,
'defer_loading' => true
]
],
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.haitoken.ai/v1/responses"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"context_management\": [\n {\n \"compact_threshold\": 123,\n \"type\": \"<string>\"\n }\n ],\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"parallel_tool_calls\": true,\n \"previous_response_id\": \"<string>\",\n \"prompt_cache_key\": \"<string>\",\n \"safety_identifier\": \"<string>\",\n \"stream_options\": {\n \"include_obfuscation\": true\n },\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"background\": true,\n \"conversation\": {},\n \"include\": [\n \"<string>\"\n ],\n \"instructions\": \"<string>\",\n \"metadata\": {\n \"metadata\": \"new java.util.HashMap<>()\"\n },\n \"moderation\": {\n \"input\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n },\n \"output\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n }\n },\n \"reasoning\": {},\n \"store\": false,\n \"stream\": false,\n \"temperature\": 123,\n \"text\": {\n \"format\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n },\n \"verbosity\": \"<string>\"\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true,\n \"defer_loading\": true\n }\n ],\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.haitoken.ai/v1/responses")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"context_management\": [\n {\n \"compact_threshold\": 123,\n \"type\": \"<string>\"\n }\n ],\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"parallel_tool_calls\": true,\n \"previous_response_id\": \"<string>\",\n \"prompt_cache_key\": \"<string>\",\n \"safety_identifier\": \"<string>\",\n \"stream_options\": {\n \"include_obfuscation\": true\n },\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"background\": true,\n \"conversation\": {},\n \"include\": [\n \"<string>\"\n ],\n \"instructions\": \"<string>\",\n \"metadata\": {\n \"metadata\": \"new java.util.HashMap<>()\"\n },\n \"moderation\": {\n \"input\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n },\n \"output\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n }\n },\n \"reasoning\": {},\n \"store\": false,\n \"stream\": false,\n \"temperature\": 123,\n \"text\": {\n \"format\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n },\n \"verbosity\": \"<string>\"\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true,\n \"defer_loading\": true\n }\n ],\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.haitoken.ai/v1/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"context_management\": [\n {\n \"compact_threshold\": 123,\n \"type\": \"<string>\"\n }\n ],\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"parallel_tool_calls\": true,\n \"previous_response_id\": \"<string>\",\n \"prompt_cache_key\": \"<string>\",\n \"safety_identifier\": \"<string>\",\n \"stream_options\": {\n \"include_obfuscation\": true\n },\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"background\": true,\n \"conversation\": {},\n \"include\": [\n \"<string>\"\n ],\n \"instructions\": \"<string>\",\n \"metadata\": {\n \"metadata\": \"new java.util.HashMap<>()\"\n },\n \"moderation\": {\n \"input\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n },\n \"output\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n }\n },\n \"reasoning\": {},\n \"store\": false,\n \"stream\": false,\n \"temperature\": 123,\n \"text\": {\n \"format\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n },\n \"verbosity\": \"<string>\"\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true,\n \"defer_loading\": true\n }\n ],\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"incomplete_details": {
"reason": "max_output_tokens"
},
"parallel_tool_calls": true,
"tool_choice": "none",
"top_p": 123,
"completed_at": 123,
"max_output_tokens": 123,
"max_tool_calls": 123,
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"prompt_cache_retention": "in_memory",
"safety_identifier": "<string>",
"service_tier": "auto",
"top_logprobs": 123,
"id": "<string>",
"error": {
"code": "server_error",
"message": "<string>"
},
"instructions": "<string>",
"metadata": {
"key": "<string>"
},
"model": "<string>",
"object": "response",
"output": [
{}
],
"temperature": 123,
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true,
"defer_loading": true
}
],
"background": false,
"conversation": {
"id": "<string>"
},
"moderation": {
"input": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"output": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
}
},
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {
"generate_summary": "auto",
"context": "auto",
"effort": "none",
"summary": "auto"
},
"status": "completed",
"text": {
"format": {
"type": "text",
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
},
"verbosity": "<string>"
},
"truncation": "auto",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 123
}
},
"user": "<string>"
}Responses format
Create chat completions compatible with the OpenAI Responses protocol, supporting streaming and non-streaming responses
curl --request POST \
--url https://api.haitoken.ai/v1/responses \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "<string>",
"model": "<string>",
"context_management": [
{
"compact_threshold": 123,
"type": "<string>"
}
],
"max_output_tokens": 123,
"max_tool_calls": 123,
"parallel_tool_calls": true,
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"safety_identifier": "<string>",
"stream_options": {
"include_obfuscation": true
},
"top_logprobs": 123,
"top_p": 123,
"background": true,
"conversation": {},
"include": [
"<string>"
],
"instructions": "<string>",
"metadata": {
"metadata": "new java.util.HashMap<>()"
},
"moderation": {
"input": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"output": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
}
},
"reasoning": {},
"store": false,
"stream": false,
"temperature": 123,
"text": {
"format": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
},
"verbosity": "<string>"
},
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true,
"defer_loading": true
}
],
"user": "<string>"
}
'import requests
url = "https://api.haitoken.ai/v1/responses"
payload = {
"input": "<string>",
"model": "<string>",
"context_management": [
{
"compact_threshold": 123,
"type": "<string>"
}
],
"max_output_tokens": 123,
"max_tool_calls": 123,
"parallel_tool_calls": True,
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"safety_identifier": "<string>",
"stream_options": { "include_obfuscation": True },
"top_logprobs": 123,
"top_p": 123,
"background": True,
"conversation": {},
"include": ["<string>"],
"instructions": "<string>",
"metadata": { "metadata": "new java.util.HashMap<>()" },
"moderation": {
"input": {
"category_applied_input_types": { "key": {} },
"category_scores": { "key": {} },
"categories": { "key": {} },
"flagged": True,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"output": {
"category_applied_input_types": { "key": {} },
"category_scores": { "key": {} },
"categories": { "key": {} },
"flagged": True,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
}
},
"reasoning": {},
"store": False,
"stream": False,
"temperature": 123,
"text": {
"format": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": True
},
"verbosity": "<string>"
},
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": True,
"defer_loading": True
}
],
"user": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: '<string>',
model: '<string>',
context_management: [{compact_threshold: 123, type: '<string>'}],
max_output_tokens: 123,
max_tool_calls: 123,
parallel_tool_calls: true,
previous_response_id: '<string>',
prompt_cache_key: '<string>',
safety_identifier: '<string>',
stream_options: {include_obfuscation: true},
top_logprobs: 123,
top_p: 123,
background: true,
conversation: {},
include: ['<string>'],
instructions: '<string>',
metadata: {metadata: 'new java.util.HashMap<>()'},
moderation: {
input: {
category_applied_input_types: {key: {}},
category_scores: {key: {}},
categories: {key: {}},
flagged: true,
model: '<string>',
type: '<string>',
code: '<string>',
message: '<string>'
},
output: {
category_applied_input_types: {key: {}},
category_scores: {key: {}},
categories: {key: {}},
flagged: true,
model: '<string>',
type: '<string>',
code: '<string>',
message: '<string>'
}
},
reasoning: {},
store: false,
stream: false,
temperature: 123,
text: {
format: {name: '<string>', description: '<string>', schema: {}, strict: true},
verbosity: '<string>'
},
tools: [
{
type: 'function',
name: '<string>',
description: '<string>',
parameters: {},
strict: true,
defer_loading: true
}
],
user: '<string>'
})
};
fetch('https://api.haitoken.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.haitoken.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>',
'model' => '<string>',
'context_management' => [
[
'compact_threshold' => 123,
'type' => '<string>'
]
],
'max_output_tokens' => 123,
'max_tool_calls' => 123,
'parallel_tool_calls' => true,
'previous_response_id' => '<string>',
'prompt_cache_key' => '<string>',
'safety_identifier' => '<string>',
'stream_options' => [
'include_obfuscation' => true
],
'top_logprobs' => 123,
'top_p' => 123,
'background' => true,
'conversation' => [
],
'include' => [
'<string>'
],
'instructions' => '<string>',
'metadata' => [
'metadata' => 'new java.util.HashMap<>()'
],
'moderation' => [
'input' => [
'category_applied_input_types' => [
'key' => [
]
],
'category_scores' => [
'key' => [
]
],
'categories' => [
'key' => [
]
],
'flagged' => true,
'model' => '<string>',
'type' => '<string>',
'code' => '<string>',
'message' => '<string>'
],
'output' => [
'category_applied_input_types' => [
'key' => [
]
],
'category_scores' => [
'key' => [
]
],
'categories' => [
'key' => [
]
],
'flagged' => true,
'model' => '<string>',
'type' => '<string>',
'code' => '<string>',
'message' => '<string>'
]
],
'reasoning' => [
],
'store' => false,
'stream' => false,
'temperature' => 123,
'text' => [
'format' => [
'name' => '<string>',
'description' => '<string>',
'schema' => [
],
'strict' => true
],
'verbosity' => '<string>'
],
'tools' => [
[
'type' => 'function',
'name' => '<string>',
'description' => '<string>',
'parameters' => [
],
'strict' => true,
'defer_loading' => true
]
],
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.haitoken.ai/v1/responses"
payload := strings.NewReader("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"context_management\": [\n {\n \"compact_threshold\": 123,\n \"type\": \"<string>\"\n }\n ],\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"parallel_tool_calls\": true,\n \"previous_response_id\": \"<string>\",\n \"prompt_cache_key\": \"<string>\",\n \"safety_identifier\": \"<string>\",\n \"stream_options\": {\n \"include_obfuscation\": true\n },\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"background\": true,\n \"conversation\": {},\n \"include\": [\n \"<string>\"\n ],\n \"instructions\": \"<string>\",\n \"metadata\": {\n \"metadata\": \"new java.util.HashMap<>()\"\n },\n \"moderation\": {\n \"input\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n },\n \"output\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n }\n },\n \"reasoning\": {},\n \"store\": false,\n \"stream\": false,\n \"temperature\": 123,\n \"text\": {\n \"format\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n },\n \"verbosity\": \"<string>\"\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true,\n \"defer_loading\": true\n }\n ],\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.haitoken.ai/v1/responses")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"context_management\": [\n {\n \"compact_threshold\": 123,\n \"type\": \"<string>\"\n }\n ],\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"parallel_tool_calls\": true,\n \"previous_response_id\": \"<string>\",\n \"prompt_cache_key\": \"<string>\",\n \"safety_identifier\": \"<string>\",\n \"stream_options\": {\n \"include_obfuscation\": true\n },\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"background\": true,\n \"conversation\": {},\n \"include\": [\n \"<string>\"\n ],\n \"instructions\": \"<string>\",\n \"metadata\": {\n \"metadata\": \"new java.util.HashMap<>()\"\n },\n \"moderation\": {\n \"input\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n },\n \"output\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n }\n },\n \"reasoning\": {},\n \"store\": false,\n \"stream\": false,\n \"temperature\": 123,\n \"text\": {\n \"format\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n },\n \"verbosity\": \"<string>\"\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true,\n \"defer_loading\": true\n }\n ],\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.haitoken.ai/v1/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"<string>\",\n \"model\": \"<string>\",\n \"context_management\": [\n {\n \"compact_threshold\": 123,\n \"type\": \"<string>\"\n }\n ],\n \"max_output_tokens\": 123,\n \"max_tool_calls\": 123,\n \"parallel_tool_calls\": true,\n \"previous_response_id\": \"<string>\",\n \"prompt_cache_key\": \"<string>\",\n \"safety_identifier\": \"<string>\",\n \"stream_options\": {\n \"include_obfuscation\": true\n },\n \"top_logprobs\": 123,\n \"top_p\": 123,\n \"background\": true,\n \"conversation\": {},\n \"include\": [\n \"<string>\"\n ],\n \"instructions\": \"<string>\",\n \"metadata\": {\n \"metadata\": \"new java.util.HashMap<>()\"\n },\n \"moderation\": {\n \"input\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n },\n \"output\": {\n \"category_applied_input_types\": {\n \"key\": {}\n },\n \"category_scores\": {\n \"key\": {}\n },\n \"categories\": {\n \"key\": {}\n },\n \"flagged\": true,\n \"model\": \"<string>\",\n \"type\": \"<string>\",\n \"code\": \"<string>\",\n \"message\": \"<string>\"\n }\n },\n \"reasoning\": {},\n \"store\": false,\n \"stream\": false,\n \"temperature\": 123,\n \"text\": {\n \"format\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n },\n \"verbosity\": \"<string>\"\n },\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true,\n \"defer_loading\": true\n }\n ],\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": 123,
"incomplete_details": {
"reason": "max_output_tokens"
},
"parallel_tool_calls": true,
"tool_choice": "none",
"top_p": 123,
"completed_at": 123,
"max_output_tokens": 123,
"max_tool_calls": 123,
"previous_response_id": "<string>",
"prompt_cache_key": "<string>",
"prompt_cache_retention": "in_memory",
"safety_identifier": "<string>",
"service_tier": "auto",
"top_logprobs": 123,
"id": "<string>",
"error": {
"code": "server_error",
"message": "<string>"
},
"instructions": "<string>",
"metadata": {
"key": "<string>"
},
"model": "<string>",
"object": "response",
"output": [
{}
],
"temperature": 123,
"tools": [
{
"type": "function",
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true,
"defer_loading": true
}
],
"background": false,
"conversation": {
"id": "<string>"
},
"moderation": {
"input": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
},
"output": {
"category_applied_input_types": {
"key": {}
},
"category_scores": {
"key": {}
},
"categories": {
"key": {}
},
"flagged": true,
"model": "<string>",
"type": "<string>",
"code": "<string>",
"message": "<string>"
}
},
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {
"generate_summary": "auto",
"context": "auto",
"effort": "none",
"summary": "auto"
},
"status": "completed",
"text": {
"format": {
"type": "text",
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
},
"verbosity": "<string>"
},
"truncation": "auto",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 123
}
},
"user": "<string>"
}Features
- Supports both streaming (SSE) and non-streaming response modes
- Supports function calling and tool calling
- Supports structured output (JSON Schema)
- Supports reasoning effort configuration
- Supports web search options
Use cases
Suitable for scenarios requiring interaction with OpenAI-compatible models, including:- Single-turn or multi-turn conversations
- Function calling and tool orchestration
- Structured JSON output
- Real-time streaming responses
Authentication
Include theAuthorization header in the format Bearer YOUR_API_KEY.
previous_response_idconversation
input parameter.Quick example
import requests
url = "https://api.haitoken.ai/v1/responses"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"model": "gpt-5.4",
"input": "Hello, please introduce yourself"
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
const response = await fetch('https://api.haitoken.ai/v1/responses', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-5.4',
input: 'Hello, please introduce yourself'
})
});
const data = await response.json();
console.log(data);
curl -X POST 'https://api.haitoken.ai/v1/responses' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-5.4",
"input": "Hello, please introduce yourself"
}'
Headers
API Key token (Bearer sk-xxx)
"application/json"
Body
Input content, can be a string or a list of input items.
Model ID, e.g. gpt-4o, gpt-5, etc.
Context management configuration.
Show child attributes
Show child attributes
Maximum number of output tokens (including visible output and reasoning tokens).
Maximum total number of built-in tool calls.
Whether to enable parallel tool calls.
Previous response ID, used for multi-turn conversations.
Prompt cache key, used to replace user to improve cache hit rate.
Prompt cache retention policy
in_memory, 24h Safety identifier.
{auto=auto, default=default, flex=flex, scale=scale, priority=priority}
auto, default, flex, scale, priority Streaming response options, only set when {@code stream: true}.
Show child attributes
Show child attributes
Tool selection strategy: none, auto, required, or a tool selection object with type/name.
none, auto, required Number of most likely tokens to return per token position (0-20).
Nucleus sampling.
Whether to run the response in the background.
Associated conversation. Can be a conversation ID string or a conversation object with id {@link ResponseConversationParam}.
Additional data items to include.
System/developer instructions.
Metadata, up to 16 key-value pairs.
Show child attributes
Show child attributes
Content moderation configuration.
Show child attributes
Show child attributes
Reusable prompt template reference.
Show child attributes
Show child attributes
Reasoning model configuration (gpt-5 and o-series models).
Show child attributes
Show child attributes
Whether to store the response.
Whether to enable streaming output (native OpenAI Responses API field, also used for gateway streaming judgment).
Sampling temperature.
Text/structured output configuration, replaces the old response_format.
Show child attributes
Show child attributes
Tool list, supports function, web_search_preview, file_search, computer_use_preview, etc.
OpenAI Responses API base tool definition. Supports multiple tool types including function, file_search, web_search_preview, etc.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
Show child attributes
Show child attributes
{auto=auto, disabled=disabled}
auto, disabled User identifier (deprecated, use safety_identifier / prompt_cache_key instead).
Response
Creation time (Unix timestamp, seconds)
Incomplete details
Show child attributes
Show child attributes
Whether to enable parallel tool calls
Tool selection strategy
none, auto, required Nucleus sampling
Completion time (Unix timestamp, seconds)
Maximum output token count
Maximum total number of built-in tool calls
Previous response ID
Prompt cache key
{in_memory=in_memory, 24h=24h}
in_memory, 24h Safety identifier
{auto=auto, default=default, flex=flex, scale=scale, priority=priority}
auto, default, flex, scale, priority Number of most likely tokens to return per token position
Response unique ID
Error message
Show child attributes
Show child attributes
System/developer instructions. Can be a string or a list of input items.
Metadata, up to 16 key-value pairs
Show child attributes
Show child attributes
Model ID in use
Object type, always "response"
Output item list
Sampling temperature
Tool list
OpenAI Responses API base tool definition. Supports multiple tool types including function, file_search, web_search_preview, etc.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
Show child attributes
Show child attributes
Whether to run the response in the background
Associated conversation
Show child attributes
Show child attributes
Input/output content moderation configuration
Show child attributes
Show child attributes
Reusable prompt template reference
Show child attributes
Show child attributes
Reasoning model configuration
Show child attributes
Show child attributes
{completed=completed, failed=failed, in_progress=in_progress, cancelled=cancelled, queued=queued, incomplete=incomplete}
completed, failed, in_progress, cancelled, queued, incomplete Text/structured output configuration
Show child attributes
Show child attributes
{auto=auto, disabled=disabled}
auto, disabled Usage statistics
Show child attributes
Show child attributes
User identifier (deprecated)