Responses
Create a response with the OpenAI-compatible Responses API. Compatible models can use the Responses-only hosted tool-search pilot by adding a nanogpt:tool_search or tool_search entry and marking function tools with defer_loading: true. The NanoGPT Advisor extension is available for non-streaming, foreground, platform-billed pay-as-you-go API-key requests that do not use client tools, structured output, inline moderation, BYOK, accountless payment, memory, or server-side content enhancements.
/v1/responses accepts compressed request bodies (Content-Encoding: gzip, deflate, or br) on authenticated JSON requests — useful for long conversations, where compressed uploads cut time-to-first-token. See Compressed Request Bodies.Overview
The/v1/responses API is an OpenAI Responses API-compatible endpoint for creating AI model responses. It supports:
- Stateless and stateful (conversation threading) chat completions
- Streaming responses via Server-Sent Events (SSE)
- Background (async) processing for long-running requests
- Response storage and retrieval
- Function/tool calling support
- Multimodal inputs (images, video, files) for supported models
https://api.nano-gpt.com/api/v1 for Responses API clients. This dedicated API host accepts request bodies up to NanoGPT’s 32 MiB application limit and avoids the smaller ingress limit on the website host. It is especially important for Codex and other long-running agents that resend accumulated conversation state.POST /api/v1/responses requests can be quoted without an account or API key on supported deployments when the initial quote request includes x-x402: true. Streaming and background Responses have implementation coverage but are not part of the stable public accountless contract. This endpoint supports accountless x402 payments where listed by GET /api/v1/x402/endpoints, including Lightning L402 when advertised. See Accountless x402 API Payments for the full flow.X-Provider explicitly selects a provider for the request and is always billed pay-as-you-go at the selected provider’s price, including provider-selection markup. For provider-selection-capable models, model may include routing preference suffixes such as :fast (alias for :speed) and :cheap (alias for :price). These are billed like explicit provider selection and follow the same conflict rules. For subscription users, sending X-Provider bypasses subscription coverage for that request; X-Billing-Mode: paygo is only needed when forcing pay-as-you-go without an explicit provider or when saved provider preferences should apply to subscription-included traffic. See Provider Selection, Model Suffixes, and Pay-As-You-Go Billing Override.advisor object so the executor model can consult one different model before returning its final answer. Use mode: "auto" to let the executor decide or mode: "required" to require a consultation attempt. Each completed model phase is billed separately. Advisor is a NanoGPT extension, not part of the standard OpenAI request schema. See Advisor.nanogpt:tool_search and mark functions with defer_loading: true. This pilot is Responses-only. See Hosted tool search.Authentication
Use an API key for normal authenticated billing:x-team-id to choose team context when team defaults are evaluated (for example, retention defaults).
For supported accountless x402 requests, omit Authorization and x-api-key, and include x-x402: true to receive a payment quote. The advertised schemes, including Lightning L402 when enabled, are listed by GET /api/v1/x402/endpoints.
If you receive 401 missing_api_key immediately, check that the initial quote request includes x-x402: true. Without that header, NanoGPT does not enter the x402 quote flow.
Endpoints
POST /v1/responses- Create a new response from the modelGET /v1/responses- Returns endpoint informationGET /v1/responses/{id}- Retrieve a stored response by IDDELETE /v1/responses/{id}- Delete a stored response (soft delete)
Batch processing
For high-volume work that does not need an immediate response,/v1/responses requests can be submitted through the Batch API. Responses batches are non-streaming, stateless, use direct OpenAI models, and run with store: false. Function and custom tools, structured text output, and remote or data-URL images are supported; video input remains unsupported in Responses Batch. Stateful features, provider-hosted tools, file references, and NanoGPT-only request extensions are not.
BYOK Encryption (Stored Responses)
If you setstore: true, you can optionally encrypt the stored response at rest using your own key or passphrase.
To encrypt a stored response, include one of these headers on POST /v1/responses:
x-encryption-key: YOUR_ENCRYPTION_KEYx-encryption-passphrase: YOUR_PASSPHRASE
Create Response
Request
Request Body
Reproducibility guidance
Seeded generation is best-effort. To reduce avoidable variation:- Keep the exact model, input, instructions, tools, and sampling settings unchanged.
- Select a specific provider where possible.
- Disable automatic fallbacks where supported when route consistency matters.
- Use a low or zero
temperaturewhere supported. - Do not treat seeded output as byte-identical. Record provider, route, and system-fingerprint metadata when NanoGPT exposes reliable values.
Response Storage And Retention
NanoGPT supports local Responses API storage for features that need server-side state, including response retrieval,previous_response_id threading, and background processing.
Set store: false to disable stored Responses API data for a request:
retentionDays or retention_days:
0 means do not retain stored response data for that request:
0 to 365 days, or null to use the next configured default. If both retentionDays and retention_days are sent, they must match.
Team and user defaults are configurable through API endpoints, not the main web Settings page today. Team owners/admins can set responses_retention_days with PATCH /api/teams/{teamUuid}/settings; users can set responsesRetentionDays with POST /api/user/responses-retention. See Teams: response retention defaults.
Retention Resolution
Effective retention for/v1/responses resolves in this order:
- Request override (
retention_days/retentionDays) - Team setting (
responses_retention_days) - User setting (
responsesRetentionDays) - Platform default (
7days)
retention_daysandretentionDaysaccept integer values0..365, ornull.nullmeans “no request override” and falls back to team/user/platform defaults.- If both request fields are provided, they must match.
- Invalid retention values return
400withinvalid_request_error. 0enables zero-retention behavior for that request.- Existing clients that omit retention fields keep default behavior (team/user/platform retention resolution).
0:
previous_response_idis rejected.backgroundis rejected.
- If
x-team-idis present and the caller is a member, that team is used. - Otherwise, the API uses the caller session’s default team (
default_team_uuid/default_team_id) when membership is valid.
Input Types
Theinput parameter accepts either a simple string or an array of input items.
Simple String Input
Array Input
Input Item Types
Message Item
user, assistant, system, developer
Content can be a string or an array of content parts:
Content Part Types
Image Input
detail parameter can be: auto, low, or high.
Video Input
Useinput_video for video understanding on a model that advertises video input:
video_url may be a public HTTPS URL or a valid data:video/*;base64,... URL. Chat-style video_url content parts are accepted as a compatibility alias, but input_video is the canonical Responses shape.
input_file is treated as video only when NanoGPT can safely identify it from a video/* MIME type, video data URL, or recognized video filename/URL extension. PDFs, audio files, and unknown or opaque files are not silently treated as video. An opaque file_id is not resolved for Responses video input; it returns video_file_id_not_supported.
Video is currently rejected in Responses Batch. Segment offsets are validated but no current public text-model route can honor them; valid offsets return video_segment_not_supported.
Function Call Item
Function Call Output Item
Tools
Provide function tools and built-in tools the model can use:Function Tool
Define functions that the model can call:Hosted Tool Search
For large function catalogs, add onenanogpt:tool_search entry (or its tool_search alias) and mark discoverable functions with defer_loading: true:
tool_search_call. A selected function is still returned as a normal function_call; your client executes it and sends function_call_output. See Hosted tool search for limits, billing, authorization, and compatibility.
Web Search Tool
File Search Tool
Code Interpreter Tool
MCP Tool
Image Generation Tool
Tool Choice
Useallowed_tools to restrict which tools the model may choose from:
Function Tool Normalization
Function tools in responses always include nullable fields:Reasoning Configuration
Usereasoning to control depth and visibility of reasoning output:
Text/Format Configuration
Control response format and verbosity:Text Parameter Structure
Format Types
{ "type": "text" }- Plain text (default){ "type": "json_object" }- JSON object output{ "type": "json_schema", "json_schema": { ... } }- Structured JSON with schema
Verbosity Values
low- Short, compact responsesmedium- Balanced detailhigh- Most detailed output
JSON Schema Format
Response Format
Successful Response
Response Fields
All fields below are always present; nullable values indicate an option was not set.Usage Object
Theusage object always includes token details:
Response Status Values
reasoning Response Field
text Response Field (Resolved)
Output Item Types
All output items include astatus field.
Message Output
Function Call Output
Hosted Tool Search Call
function_call.
Reasoning Output (reasoning-capable models)
Web Search Call Output
Image Generation Call Output
Computer Call Output
Output Item Status Values
Output Text Parts
Output text parts include annotations and logprobs:Annotation Types
URL Citation
File Citation
File Path
Streaming
See also: Streaming Protocol (SSE). Enable streaming to receive incremental response updates:Streaming Response
The response is delivered as Server-Sent Events (SSE):Streaming Event Types
Updated Event Fields
- All content/output events include
item_idfor the parent output item. - Text delta/done events include
logprobs.
response.output_text.delta:
Conversation Threading
Chain responses together for multi-turn conversations. You can useprevious_response_id or the conversation object (id or messages) to manage context.
First Request
id: "resp_abc123"
Follow-up Request
previous_response_id requires authentication, store: true on previous responses, and effective retention greater than 0.
Background Mode
For long-running requests, use background mode to receive an immediate response and poll for results.Initiate Background Request
Immediate Response (202 Accepted)
Poll for Completion
status is completed, failed, or incomplete.
Constraints:
- Cannot be combined with
stream: true - Requires authentication
- Effective retention must be greater than
0 - Maximum processing time: approximately 800 seconds
Retrieve Response
Response
Returns the full response object (same format as POST response).Errors
404- Response not found or belongs to different account401- Authentication required/invalid
Delete Response
Response
Error Handling
Error Response Format
HTTP Status Codes
Common Error Codes
Complete Examples
Simple Text Completion
Multi-turn Conversation
Streaming Response
Per-request Retention Override
Function Calling
Submitting Tool Results
Image Input (Vision)
Video Input (Understanding)
Video input is separate from video generation and is available only on models advertising video capability. See the Video Input guide for source rules, limits, YouTube behavior, and validation errors.JSON Output
Background Processing
Limitations
- Deep research models: Deep research variants are not supported.
- GPU-TEE streaming: Streaming is not supported for GPU-TEE models. Use
/v1/chat/completionsfor these models. - Background mode: Maximum duration is approximately 800 seconds.
- Metadata limits: Maximum 16 keys, 64 character key names, 512 character values.
- Hosted tool search: Available only on compatible models in foreground Responses requests. It cannot currently be combined with background mode or other hosted built-ins. See Hosted tool search.
Service tiers (flex and priority)
Setservice_tier to request a non-default capacity tier on providers that support service tiers:
autoor omitted: use NanoGPT’s normal routing and the provider default.default: request the provider’s standard tier where the provider accepts an explicit default value.flex: request lower-cost, variable-capacity processing where supported.priority: request higher-cost priority processing where supported.
- Service tier availability is model- and provider-specific. Model pages show which tiers are supported.
- Flex and priority tiers are only applied when the routed provider supports them.
- Header provider overrides (like
X-Provider) and explicit provider selection are honored for pricing and x402 estimates. - Provider-native web search can force routing; tier pricing follows that routing.
- If you explicitly force a provider that does not support service tiers, the requested tier may be ignored by the upstream provider, or routing and pricing may differ from the default route.
- Flex tier billing uses flex pricing where applicable.
- Priority tier billing uses priority pricing where applicable.
- High-context pricing may also apply for models and providers with separate high-context SKUs, such as
es2kpricing for GPT-5.5/GPT-5.4 where available.
Example: flex tier
Example: priority tier
Response Headers
All responses include:Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Optional explicit provider override for supported open-source models (case-insensitive). Explicit provider selection is billed pay-as-you-go at the selected provider's price, including provider-selection markup; for subscription users it bypasses subscription coverage for that request.
Optional billing override to force pay-as-you-go without an explicit provider, or to apply saved provider preferences to subscription-included traffic (e.g., paygo). Header name is case-insensitive.
Optional team context override for API-key requests. If provided, it must reference a team the caller belongs to.
Set to true on unauthenticated accountless x402 quote requests. Without this header, unauthenticated requests return 401 missing_api_key.
true Body
Parameters for the response request
Model ID to use for the response. Provider-selection-capable models may include routing preference suffixes such as ':fast', ':speed', ':cheap', ':price', ':latency', ':throughput', ':floor', ':tools', ':caching', ':cache', or ':cached'.
Prompt string or array of input items. Use an input_video content part with a video_url field for video understanding.
Billing override to force pay-as-you-go without an explicit provider, or to apply saved provider preferences to subscription-included traffic. Accepted values (case-insensitive): paygo, pay-as-you-go, pay_as_you_go, paid, payg.
Alias for billing_mode.
System instructions for the model
Maximum tokens in the response
x >= 16Sampling temperature (not supported by reasoning models)
0 <= x <= 2Nucleus sampling parameter
0 <= x <= 1Tools available to the model. The Responses-only hosted tool-search pilot accepts one nanogpt:tool_search or tool_search entry plus function tools marked defer_loading: true on compatible models.
- Option 1
- Option 2
- Option 3
How the model should use tools
Allow multiple tool calls in parallel
Enable streaming responses
Store the response locally for later retrieval/threading/background processing. Set false to disable stored Responses API data for the request.
Per-request retention override in days (0..365). Use 0 to disable retention for the request; use null to fall back to configured defaults.
0 <= x <= 365Alias for retention_days (0..365). If both are provided, values must match.
0 <= x <= 365Link to previous response for conversation threading
Reasoning configuration. Setting reasoning.effort to any non-none value explicitly requests reasoning mode.
Text/format configuration
Custom metadata
Truncation strategy
auto, disabled Unique user identifier
Optional integer forwarded on model/provider routes that support seeded sampling. This may improve reproducibility but does not guarantee identical output. Results can change if NanoGPT selects a different automatic or fallback route, or if the provider changes its backend.
Enable background/async processing
Optional service tier: "auto", "default", "flex", or "priority". Use "flex" for lower-cost variable-capacity processing or "priority" for higher-cost priority processing where supported by the routed model/provider.
auto, default, flex, priority Allows the executor model to consult one different advisor model. Auto mode lets the executor decide whether to consult; required mode forces one consultation request. Advisor is non-streaming and available only for platform-billed pay-as-you-go API-key requests. Subscriptions, BYOK, accountless x402, Private Mode, inline moderation, client tools, structured outputs, memory, and server-side content enhancements are rejected before orchestration. Each completed executor, advisor, and continuation phase is billed separately.
Response
Response created
Response object returned by the Responses API
queued, in_progress, completed, incomplete, failed, cancelled Advisor orchestration status and per-phase usage. Present on responses to requests that use the Advisor extension.