Skip to content

Responses API

POST https://api.bve.me/v1/responses

Requires Authorization: Bearer sk-bve-YOUR_KEY.

The Responses API is OpenAI’s newer, stateful generation interface. BVE Gateway proxies this endpoint directly to Fuelix.

{
"model": "gpt-4o",
"input": "What is 2 + 2?",
"max_output_tokens": 100
}
FieldTypeRequiredDescription
modelstringYesGPT model ID (e.g. gpt-4o, gpt-4.1)
inputstring or arrayYesText prompt or message array
instructionsstringNoSystem-level instructions (equivalent to a system message)
max_output_tokensintegerNoMax tokens (minimum 16)
temperaturenumberNoSampling temperature — [0, 2]
top_pnumberNoNucleus sampling — [0, 1]
streambooleanNoEnable SSE streaming
storebooleanNoPersist the response in OpenAI’s response store
parallel_tool_callsbooleanNoAllow the model to call multiple tools simultaneously
toolsarrayNoTool definitions for function calling
tool_choicestring or objectNoTool selection — "none", "auto", "required", or {type:"function", function:{name}}
response_formatobjectNoOutput format — {type:"text"}, {type:"json_object"}, or {type:"json_schema", json_schema:{name, schema}}
reasoningobjectNoReasoning budget for o-series models — {effort: "low" | "medium" | "high", summary?: string}. Note: "auto" is not accepted here; use the top-level reasoning_effort field with "auto" in /v1/chat/completions instead
userstringNoEnd-user identifier forwarded to Fuelix for abuse detection (≤ 256 chars)
previous_response_idstringNoResponse ID to continue — enables multi-turn conversations
truncationstringNoContext-window truncation strategy when the conversation exceeds the model limit: "auto" or "disabled"
metadataobjectNoString-to-string map attached to the response for caller tracking (max 16 pairs; keys ≤ 64 chars; values ≤ 512 chars)
{
"id": "resp_abc123",
"object": "response",
"created_at": 1716288000,
"model": "gpt-4o-2024-11-20",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "4" }
]
}
],
"usage": {
"input_tokens": 7,
"output_tokens": 1,
"total_tokens": 8
}
}
Terminal window
curl https://api.bve.me/v1/responses \
-H "Authorization: Bearer sk-bve-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"input": "What is 2 + 2?",
"max_output_tokens": 100
}'
Terminal window
# First turn
curl https://api.bve.me/v1/responses \
-H "Authorization: Bearer sk-bve-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"input": "My name is Alice.",
"max_output_tokens": 100
}'
# Second turn (reference the previous response)
curl https://api.bve.me/v1/responses \
-H "Authorization: Bearer sk-bve-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"input": "What is my name?",
"previous_response_id": "resp_abc123",
"max_output_tokens": 100
}'
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-bve-YOUR_KEY',
baseURL: 'https://api.bve.me/v1',
});
const response = await client.responses.create({
model: 'gpt-4o',
input: 'What is 2 + 2?',
});
console.log(response.output_text);

Pass "stream": true (or use client.responses.stream()) to receive a Server-Sent Events stream. See Streaming — Responses API for the event format and a full code example.

const stream = client.responses.stream({
model: 'gpt-4o',
input: 'Count from 1 to 5.',
});
for await (const event of stream) {
if (event.type === 'response.output_text.delta') {
process.stdout.write(event.delta);
}
}
const finalResponse = await stream.finalResponse();
console.log('Usage:', finalResponse.usage);
GET https://api.bve.me/v1/responses/:id

Retrieve a previously created response by its ID. Proxied directly to Fuelix.

Terminal window
curl https://api.bve.me/v1/responses/resp_abc123 \
-H "Authorization: Bearer sk-bve-YOUR_KEY"
DELETE https://api.bve.me/v1/responses/:id

Delete a stored response. Proxied directly to Fuelix. Returns 200 with a deletion confirmation object on success.

Terminal window
curl -X DELETE https://api.bve.me/v1/responses/resp_abc123 \
-H "Authorization: Bearer sk-bve-YOUR_KEY"

The gateway validates required fields before forwarding to Fuelix. Missing or invalid fields return 400 with a standard error shape instead of a Fuelix-specific Pydantic error.

Missing / invalidCodeparam
model absentmissing_required_parameter"model"
model not a stringinvalid_type"model"
input absentmissing_required_parameter"input"
input not a string or arrayinvalid_type"input"
FieldConstraintCodeparam
instructionsmust be a stringinvalid_type"instructions"
temperaturemust be a numberinvalid_type"temperature"
temperaturemust be in [0, 2]invalid_value"temperature"
top_pmust be a numberinvalid_type"top_p"
top_pmust be in [0, 1]invalid_value"top_p"
max_output_tokensmust be an integer ≥ 16invalid_value"max_output_tokens"
streammust be a booleaninvalid_type"stream"
storemust be a booleaninvalid_type"store"
parallel_tool_callsmust be a booleaninvalid_type"parallel_tool_calls"
previous_response_idmust be a stringinvalid_type"previous_response_id"
truncationmust be a stringinvalid_type"truncation"
truncationmust be "auto" or "disabled"invalid_value"truncation"
metadatamust be an object (not an array)invalid_type"metadata"
metadatamust not have more than 16 key-value pairsinvalid_value"metadata"
metadata (keys)key must not exceed 64 charactersinvalid_value"metadata"
metadata["KEY"]value must be a stringinvalid_type"metadata.KEY"
metadata["KEY"]value must not exceed 512 charactersinvalid_value"metadata.KEY"
usermust be a stringinvalid_type"user"
usermust be ≤ 256 charactersinvalid_value"user"
reasoningmust be an object (not an array)invalid_type"reasoning"
reasoning.effortnot a stringinvalid_type"reasoning.effort"
reasoning.effortnot "low", "medium", or "high" (including "auto", which is only valid in /v1/chat/completions)invalid_value"reasoning.effort"
reasoning.summarymust be a stringinvalid_type"reasoning.summary"
response_formatmust be an object with a type fieldinvalid_type"response_format"
response_format.typemust be "text", "json_object", or "json_schema"invalid_value"response_format.type"
response_format.json_schemarequired when type is "json_schema"missing_required_parameter"response_format.json_schema"
response_format.json_schema.namerequired non-empty stringmissing_required_parameter"response_format.json_schema.name"
toolsnot an arrayinvalid_type"tools"
toolsempty arrayinvalid_value"tools"
tools[N]not an objectinvalid_type"tools[N]"
tools[N].typeabsentmissing_required_parameter"tools[N].type"
tools[N].typenot a stringinvalid_type"tools[N].type"
tools[N].typenot "function"invalid_value"tools[N].type"
tools[N].functionabsentmissing_required_parameter"tools[N].function"
tools[N].functionnot an objectinvalid_type"tools[N].function"
tools[N].function.nameabsent or not a stringinvalid_type"tools[N].function.name"
tools[N].function.nameempty stringinvalid_value"tools[N].function.name"
tools[N].function.namefails [a-zA-Z0-9_-]{1,64} regexinvalid_value"tools[N].function.name"
tool_choicenot a string or objectinvalid_type"tool_choice"
tool_choice (string)not "none", "auto", or "required"invalid_value"tool_choice"
tool_choice.typeabsentmissing_required_parameter"tool_choice.type"
tool_choice.typenot a stringinvalid_type"tool_choice.type"
tool_choice.typenot "function"invalid_value"tool_choice.type"
tool_choice.functionabsentmissing_required_parameter"tool_choice.function"
tool_choice.functionnot an objectinvalid_type"tool_choice.function"
tool_choice.function.nameabsent or not a stringinvalid_type"tool_choice.function.name"
tool_choice.function.nameempty stringinvalid_value"tool_choice.function.name"

Example 400 response:

{
"error": {
"message": "model is required",
"type": "invalid_request_error",
"param": "model",
"code": "missing_required_parameter"
}
}

BVE Gateway adds the following headers to every authenticated response:

HeaderExampleDescription
X-Request-Id550e8400-…UUID for this request (generated per request)
X-BVE-Client-Idmy-trace-123Echo of the client-supplied X-Request-Id (when present and valid: alphanumeric + -_., ≤ 128 chars). Absent when not supplied or value failed validation.
X-BVE-Latency143Total gateway latency in milliseconds
X-BVE-Modelgpt-4oModel ID resolved for this request
X-BVE-Key-Nameprod-keyName of the API key used for this request (redacted if it matches a provider credential pattern)

The full X-RateLimit-* header set (RPM, RPD, monthly) is also included. See Rate Limits & Quotas for details and example output.

  • Only GPT models are supported upstream (e.g. gpt-4o, gpt-4.1, gpt-5, o3, o4-mini).
  • For Claude or Gemini models, use /v1/chat/completions or /v1/messages instead.
  • The gateway enforces max_output_tokens >= 16 for the Responses API.
  • Token usage (input_tokens, output_tokens) is extracted and recorded in D1 for both streaming and non-streaming requests.