Skip to main content
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": {
    "effort": "low",
    "summary": true
  },
  "metadata": {}
}
'
{
  "id": "<string>",
  "object": "response",
  "created_at": 123,
  "status": "in_progress",
  "model": "<string>",
  "output": [
    {
      "id": "<string>",
      "type": "message",
      "status": "in_progress",
      "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": {}
  }
}
The Responses API provides OpenAI-compatible response endpoints.

Create Response

POST /responses Create a text response using OpenAI’s response format.

Request Body

model
string
required
The model to use for response (e.g., “gpt-4o”)
input
string | array
required
The input text or array of messages to generate responses for
instructions
string
System instructions for the model
max_output_tokens
integer
Maximum number of output tokens to generate
temperature
number
Temperature for randomness (default: 1.0)
top_p
number
Nucleus sampling parameter (default: 1.0)
stream
boolean
Whether to stream back partial progress (default: false)
tools
array
Array of tools available to the model
tool_choice
string | object
Tool choice preference (“auto”, “none”, or specific tool object)
Enable web search capabilities (default: false)
reasoning
object
Reasoning configuration with effort level and summary options
metadata
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);

Authorizations

Authorization
string
header
required

Enter your API key (starts with 'ek-')

Body

application/json
model
string
required
Example:

"gpt-4o"

input
required
instructions
string

System instructions

max_output_tokens
integer

Maximum output tokens

temperature
number
default:1
top_p
number
default:1
stream
boolean
default:false
tools
object[]
tool_choice
default:auto
Available options:
auto,
none
reasoning
object
metadata
object

Response

200 - application/json

Success

id
string
required
object
enum<string>
required
Available options:
response
created_at
integer
required
status
enum<string>
required
Available options:
in_progress,
completed,
incomplete,
errored
model
string
required
output
object[]
required
usage
object