Create Chat Completion
curl --request POST \
--url https://api.electronhub.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o",
"messages": [
{
"content": "<string>",
"reasoning": "<string>",
"reasoning_content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
}
],
"stream": false,
"max_tokens": 123,
"temperature": 1,
"top_p": 1,
"top_k": 123,
"frequency_penalty": 0,
"presence_penalty": 0,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"web_search": false,
"thinking": {
"type": "enabled",
"budget_tokens": 123
},
"reasoning": {
"exclude": true
},
"reasoning_content_compat": true
}
'import requests
url = "https://api.electronhub.ai/v1/chat/completions"
payload = {
"model": "gpt-4o",
"messages": [
{
"content": "<string>",
"reasoning": "<string>",
"reasoning_content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
}
],
"stream": False,
"max_tokens": 123,
"temperature": 1,
"top_p": 1,
"top_k": 123,
"frequency_penalty": 0,
"presence_penalty": 0,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"web_search": False,
"thinking": {
"type": "enabled",
"budget_tokens": 123
},
"reasoning": { "exclude": True },
"reasoning_content_compat": True
}
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',
messages: [
{
content: '<string>',
reasoning: '<string>',
reasoning_content: '<string>',
name: '<string>',
tool_calls: [
{
id: '<string>',
type: 'function',
function: {name: '<string>', arguments: '<string>'}
}
]
}
],
stream: false,
max_tokens: 123,
temperature: 1,
top_p: 1,
top_k: 123,
frequency_penalty: 0,
presence_penalty: 0,
tools: [
{
type: 'function',
function: {name: '<string>', description: '<string>', parameters: {}}
}
],
web_search: false,
thinking: {type: 'enabled', budget_tokens: 123},
reasoning: {exclude: true},
reasoning_content_compat: true
})
};
fetch('https://api.electronhub.ai/v1/chat/completions', 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/chat/completions",
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',
'messages' => [
[
'content' => '<string>',
'reasoning' => '<string>',
'reasoning_content' => '<string>',
'name' => '<string>',
'tool_calls' => [
[
'id' => '<string>',
'type' => 'function',
'function' => [
'name' => '<string>',
'arguments' => '<string>'
]
]
]
]
],
'stream' => false,
'max_tokens' => 123,
'temperature' => 1,
'top_p' => 1,
'top_k' => 123,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'tools' => [
[
'type' => 'function',
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]
]
],
'web_search' => false,
'thinking' => [
'type' => 'enabled',
'budget_tokens' => 123
],
'reasoning' => [
'exclude' => true
],
'reasoning_content_compat' => true
]),
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/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"reasoning\": \"<string>\",\n \"reasoning_content\": \"<string>\",\n \"name\": \"<string>\",\n \"tool_calls\": [\n {\n \"id\": \"<string>\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"arguments\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"web_search\": false,\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"reasoning\": {\n \"exclude\": true\n },\n \"reasoning_content_compat\": true\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/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"reasoning\": \"<string>\",\n \"reasoning_content\": \"<string>\",\n \"name\": \"<string>\",\n \"tool_calls\": [\n {\n \"id\": \"<string>\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"arguments\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"web_search\": false,\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"reasoning\": {\n \"exclude\": true\n },\n \"reasoning_content_compat\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/chat/completions")
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 \"messages\": [\n {\n \"content\": \"<string>\",\n \"reasoning\": \"<string>\",\n \"reasoning_content\": \"<string>\",\n \"name\": \"<string>\",\n \"tool_calls\": [\n {\n \"id\": \"<string>\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"arguments\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"web_search\": false,\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"reasoning\": {\n \"exclude\": true\n },\n \"reasoning_content_compat\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "system",
"content": "<string>",
"reasoning": "<string>",
"reasoning_content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}Chat
Chat Completions
Create a chat completion
POST
/
chat
/
completions
Create Chat Completion
curl --request POST \
--url https://api.electronhub.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o",
"messages": [
{
"content": "<string>",
"reasoning": "<string>",
"reasoning_content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
}
],
"stream": false,
"max_tokens": 123,
"temperature": 1,
"top_p": 1,
"top_k": 123,
"frequency_penalty": 0,
"presence_penalty": 0,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"web_search": false,
"thinking": {
"type": "enabled",
"budget_tokens": 123
},
"reasoning": {
"exclude": true
},
"reasoning_content_compat": true
}
'import requests
url = "https://api.electronhub.ai/v1/chat/completions"
payload = {
"model": "gpt-4o",
"messages": [
{
"content": "<string>",
"reasoning": "<string>",
"reasoning_content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
}
],
"stream": False,
"max_tokens": 123,
"temperature": 1,
"top_p": 1,
"top_k": 123,
"frequency_penalty": 0,
"presence_penalty": 0,
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"web_search": False,
"thinking": {
"type": "enabled",
"budget_tokens": 123
},
"reasoning": { "exclude": True },
"reasoning_content_compat": True
}
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',
messages: [
{
content: '<string>',
reasoning: '<string>',
reasoning_content: '<string>',
name: '<string>',
tool_calls: [
{
id: '<string>',
type: 'function',
function: {name: '<string>', arguments: '<string>'}
}
]
}
],
stream: false,
max_tokens: 123,
temperature: 1,
top_p: 1,
top_k: 123,
frequency_penalty: 0,
presence_penalty: 0,
tools: [
{
type: 'function',
function: {name: '<string>', description: '<string>', parameters: {}}
}
],
web_search: false,
thinking: {type: 'enabled', budget_tokens: 123},
reasoning: {exclude: true},
reasoning_content_compat: true
})
};
fetch('https://api.electronhub.ai/v1/chat/completions', 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/chat/completions",
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',
'messages' => [
[
'content' => '<string>',
'reasoning' => '<string>',
'reasoning_content' => '<string>',
'name' => '<string>',
'tool_calls' => [
[
'id' => '<string>',
'type' => 'function',
'function' => [
'name' => '<string>',
'arguments' => '<string>'
]
]
]
]
],
'stream' => false,
'max_tokens' => 123,
'temperature' => 1,
'top_p' => 1,
'top_k' => 123,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'tools' => [
[
'type' => 'function',
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
]
]
]
],
'web_search' => false,
'thinking' => [
'type' => 'enabled',
'budget_tokens' => 123
],
'reasoning' => [
'exclude' => true
],
'reasoning_content_compat' => true
]),
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/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"reasoning\": \"<string>\",\n \"reasoning_content\": \"<string>\",\n \"name\": \"<string>\",\n \"tool_calls\": [\n {\n \"id\": \"<string>\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"arguments\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"web_search\": false,\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"reasoning\": {\n \"exclude\": true\n },\n \"reasoning_content_compat\": true\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/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"reasoning\": \"<string>\",\n \"reasoning_content\": \"<string>\",\n \"name\": \"<string>\",\n \"tool_calls\": [\n {\n \"id\": \"<string>\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"arguments\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"web_search\": false,\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"reasoning\": {\n \"exclude\": true\n },\n \"reasoning_content_compat\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.electronhub.ai/v1/chat/completions")
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 \"messages\": [\n {\n \"content\": \"<string>\",\n \"reasoning\": \"<string>\",\n \"reasoning_content\": \"<string>\",\n \"name\": \"<string>\",\n \"tool_calls\": [\n {\n \"id\": \"<string>\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"arguments\": \"<string>\"\n }\n }\n ]\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 1,\n \"top_k\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"tools\": [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {}\n }\n }\n ],\n \"web_search\": false,\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"reasoning\": {\n \"exclude\": true\n },\n \"reasoning_content_compat\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "system",
"content": "<string>",
"reasoning": "<string>",
"reasoning_content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}Create Chat Completion
POST /v1/chat/completions
Request Body
string
required
Model to use for completion (e.g.,
gpt-4o, gpt-5.1, claude-sonnet-4-6, deepseek-r1). Append :reasoning-exclude to disable reasoning output for a single request.array
required
Array of message objects forming the conversation.
integer
Maximum number of tokens to generate. Reasoning tokens are billed as output tokens and counted against this limit.
number
Sampling temperature between 0 and 2.
boolean
Enable streaming responses (SSE).
string
Controls reasoning depth on supported models. One of
none, minimal, low, medium, high, xhigh. Silently ignored for models that don’t support reasoning_effort.object
Reasoning configuration object. Supports:
reasoning.effort— same enum asreasoning_effort.reasoning.exclude(boolean) — strip reasoning from the response entirely.reasoning.delta_field—"reasoning"or"reasoning_content"; overrides the streaming/non-streaming field name regardless of which endpoint variant was hit.
string
Shorthand for
reasoning.delta_field. Accepts "reasoning" or "reasoning_content".boolean
Shorthand: set to
true to force the legacy reasoning_content field, equivalent to reasoning.delta_field = "reasoning_content".Endpoint Variants (Reasoning Output)
Some models emit a separate reasoning / thinking stream in addition to the final answer. Three base paths control how that stream is surfaced — all of them accept the same request shape and model names.| Base path | Behavior | Use when |
|---|---|---|
POST /v1/chat/completions | Reasoning and answer are returned as separate fields (reasoning + content). Default. | Most OpenAI-compatible clients. |
POST /v1legacy/chat/completions | Same as /v1/, but reasoning uses the legacy field name reasoning_content. | Clients that only parse reasoning_content (e.g. older DeepSeek SDKs). |
POST /v1thinking/chat/completions | Reasoning and answer are merged into the normal content stream, wrapped in <think>...</think> tags. | Clients that ignore reasoning fields but should still display thoughts inline. |
reasoning.delta_field, reasoning_delta_field, reasoning_content_compat) take precedence over the endpoint default. If a model does not emit reasoning, these fields are simply absent from the response.
Streaming output shape
When reasoning is delivered as a separate field, deltas are interleaved — reasoning chunks come first, followed by content chunks:data: {"id":"chatcmpl-...","choices":[{"index":0,"delta":{"reasoning":"Let me think..."},"finish_reason":null}], ...}
data: {"id":"chatcmpl-...","choices":[{"index":0,"delta":{"content":"The answer is 4."},"finish_reason":null}], ...}
data: [DONE]
/v1legacy/chat/completions the same deltas use delta.reasoning_content instead of delta.reasoning.
Against /v1thinking/chat/completions everything appears in delta.content:
data: {"choices":[{"delta":{"content":"<think>Let me think...</think>The answer is 4."}}]}
Non-streaming output shape
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "The answer is 4.",
"reasoning": "Let me think..."
},
"finish_reason": "stop"
}],
"usage": { "...": "..." }
}
reasoning becomes reasoning_content on /v1legacy/. On /v1thinking/, the reasoning stays embedded inside content ("<think>...</think>The answer...") and no separate field is emitted.
Disabling Reasoning Output
Reasoning can be hidden in three equivalent ways — the model still pays the cost for reasoning compute, but the tokens are stripped from the response:- Request body:
{ "reasoning": { "exclude": true } } - Model suffix:
"model": "deepseek-r1:reasoning-exclude" - Request body:
{ "reasoning_effort": "none" }(only honored on OpenAI-shaped models — safely ignored elsewhere for API parity).
reasoning field nor <think> tags appear in the response, regardless of which endpoint variant was hit.
Example
import requests
# Default: reasoning + content in separate fields
response = requests.post(
'https://api.electronhub.ai/v1/chat/completions',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'model': 'deepseek-r1',
'messages': [{'role': 'user', 'content': "What's 2 + 2?"}],
'reasoning_effort': 'medium'
}
)
data = response.json()
print(data['choices'][0]['message']['reasoning']) # thinking text
print(data['choices'][0]['message']['content']) # answer
const res = await fetch('https://api.electronhub.ai/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ELECTRONHUB_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'deepseek-r1',
messages: [{ role: 'user', content: "What's 2 + 2?" }],
reasoning_effort: 'medium'
})
});
const data = await res.json();
console.log(data.choices[0].message.reasoning);
console.log(data.choices[0].message.content);
# Legacy field name (reasoning_content)
curl https://api.electronhub.ai/v1legacy/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-r1",
"messages": [{"role": "user", "content": "What is 2+2?"}]
}'
# Merged (<think> inline)
curl https://api.electronhub.ai/v1thinking/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-r1",
"messages": [{"role": "user", "content": "What is 2+2?"}]
}'
# Hide reasoning entirely
curl https://api.electronhub.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-r1:reasoning-exclude",
"messages": [{"role": "user", "content": "What is 2+2?"}]
}'
Streaming
Enable real-time responses with streaming:curl https://api.electronhub.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [
{"role": "user", "content": "Tell me a story"}
],
"stream": true
}'
Function Calling
Use function calling for tool integration:curl https://api.electronhub.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{"role": "user", "content": "What is the weather like in Boston?"}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
"required": ["location"]
}
}
}
],
"tool_choice": "auto"
}'
Authorizations
Enter your API key (starts with 'ek-')
Body
application/json
Model to use for completion
Example:
"gpt-4o"
List of messages
Show child attributes
Show child attributes
Enable streaming
Maximum tokens to generate
Sampling temperature
Required range:
0 <= x <= 2Nucleus sampling
Required range:
0 <= x <= 1Top-k sampling
Required range:
-2 <= x <= 2Required range:
-2 <= x <= 2List of tools
Show child attributes
Show child attributes
Available options:
none, auto Enable web search
- Option 1
- Option 2
Show child attributes
Show child attributes
Reasoning effort level. Silently ignored for models that do not support reasoning_effort, so clients can send a single shared request across providers.
Available options:
none, minimal, low, medium, high, xhigh Reasoning configuration. Per-request override for reasoning output behavior.
Show child attributes
Show child attributes
Shorthand for reasoning.delta_field.
Available options:
reasoning, reasoning_content Shorthand: set to true to force the legacy reasoning_content field, equivalent to reasoning.delta_field = "reasoning_content".
