Create Response (OpenAI)
curl --request POST \
--url https://api.electronhub.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o",
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"temperature": 1,
"top_p": 1,
"stream": false,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"tool_choice": "auto",
"web_search": false,
"reasoning": {
"summary": true
},
"metadata": {}
}
'import requests
url = "https://api.electronhub.ai/v1/responses"
payload = {
"model": "gpt-4o",
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"temperature": 1,
"top_p": 1,
"stream": False,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"tool_choice": "auto",
"web_search": False,
"reasoning": { "summary": True },
"metadata": {}
}
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-4o',
input: '<string>',
instructions: '<string>',
max_output_tokens: 123,
temperature: 1,
top_p: 1,
stream: false,
tools: [
{
type: 'function',
function: {name: '<string>', description: '<string>', parameters: {}}
}
],
tool_choice: 'auto',
web_search: false,
reasoning: {summary: true},
metadata: {}
})
};
fetch('https://api.electronhub.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.electronhub.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-4o',
'input' => '<string>',
'instructions' => '<string>',
'max_output_tokens' => 123,
'temperature' => 1,
'top_p' => 1,
'stream' => false,
'tools' => [
[
'type' => 'function',
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]
]
],
'tool_choice' => 'auto',
'web_search' => false,
'reasoning' => [
'summary' => true
],
'metadata' => [
]
]),
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.electronhub.ai/v1/responses"
payload := strings.NewReader("{\n \"model\": \"gpt-4o\",\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"web_search\": false,\n \"reasoning\": {\n \"summary\": true\n },\n \"metadata\": {}\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.electronhub.ai/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o\",\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"web_search\": false,\n \"reasoning\": {\n \"summary\": true\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.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-4o\",\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"web_search\": false,\n \"reasoning\": {\n \"summary\": true\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "response",
"created_at": 123,
"model": "<string>",
"output": [
{
"id": "<string>",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
"<unknown>"
]
}
]
}
],
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {},
"output_tokens_details": {}
}
}API Reference
Responses API
Create a model response with the OpenAI Responses format
POST
/
responses
Create Response (OpenAI)
curl --request POST \
--url https://api.electronhub.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o",
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"temperature": 1,
"top_p": 1,
"stream": false,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"tool_choice": "auto",
"web_search": false,
"reasoning": {
"summary": true
},
"metadata": {}
}
'import requests
url = "https://api.electronhub.ai/v1/responses"
payload = {
"model": "gpt-4o",
"input": "<string>",
"instructions": "<string>",
"max_output_tokens": 123,
"temperature": 1,
"top_p": 1,
"stream": False,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"tool_choice": "auto",
"web_search": False,
"reasoning": { "summary": True },
"metadata": {}
}
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-4o',
input: '<string>',
instructions: '<string>',
max_output_tokens: 123,
temperature: 1,
top_p: 1,
stream: false,
tools: [
{
type: 'function',
function: {name: '<string>', description: '<string>', parameters: {}}
}
],
tool_choice: 'auto',
web_search: false,
reasoning: {summary: true},
metadata: {}
})
};
fetch('https://api.electronhub.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.electronhub.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-4o',
'input' => '<string>',
'instructions' => '<string>',
'max_output_tokens' => 123,
'temperature' => 1,
'top_p' => 1,
'stream' => false,
'tools' => [
[
'type' => 'function',
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]
]
],
'tool_choice' => 'auto',
'web_search' => false,
'reasoning' => [
'summary' => true
],
'metadata' => [
]
]),
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.electronhub.ai/v1/responses"
payload := strings.NewReader("{\n \"model\": \"gpt-4o\",\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"web_search\": false,\n \"reasoning\": {\n \"summary\": true\n },\n \"metadata\": {}\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.electronhub.ai/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o\",\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"web_search\": false,\n \"reasoning\": {\n \"summary\": true\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.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-4o\",\n \"input\": \"<string>\",\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"tool_choice\": \"auto\",\n \"web_search\": false,\n \"reasoning\": {\n \"summary\": true\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "response",
"created_at": 123,
"model": "<string>",
"output": [
{
"id": "<string>",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "<string>",
"annotations": [
"<unknown>"
]
}
]
}
],
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {},
"output_tokens_details": {}
}
}Create a model response from text or message input.
Create Response
POST /responses
Create a text response using OpenAI’s response format.
Request Body
string
required
The model to use for response (e.g., “gpt-4o”)
string | array
required
The input text or array of messages to generate responses for
string
System instructions for the model
integer
Maximum number of output tokens to generate
number
Temperature for randomness (default: 1.0)
number
Nucleus sampling parameter (default: 1.0)
boolean
Whether to stream back partial progress (default: false)
array
Array of tools available to the model
string | object
Tool choice preference (“auto”, “none”, or specific tool object)
boolean
Enable web search capabilities (default: false)
object
Reasoning configuration with effort level and summary options
object
Additional metadata as key-value pairs
Response
Returns a response object with the generated text.Example
const response = await fetch('https://api.electronhub.ai/v1/responses', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-4o',
input: 'Write a short story about a robot:',
instructions: 'Write in a creative and engaging style',
max_output_tokens: 500,
temperature: 0.7
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://api.electronhub.ai/v1/responses',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'model': 'gpt-4o',
'input': 'Write a short story about a robot:',
'instructions': 'Write in a creative and engaging style',
'max_output_tokens': 500,
'temperature': 0.7
}
)
print(response.json())
curl -X POST "https://api.electronhub.ai/v1/responses" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"input": "Write a short story about a robot:",
"instructions": "Write in a creative and engaging style",
"max_output_tokens": 500,
"temperature": 0.7
}'
Authorizations
Enter your API key (starts with 'ek-')
Body
application/json
Example:
"gpt-4o"
System instructions
Maximum output tokens
- Option 1
- Option 2
Show child attributes
Show child attributes
Available options:
auto, none Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
200 - application/json
Success
⌘I
