v1

latestOpenAPI 3.1.0MIT2026-07-262861121.0 KB

Creates a chat completion for the provided messages. The NanoGPT Advisor extension is available for non-streaming, 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.

post/v1/chat/completions

Headers

X-Providerstring

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.

X-Billing-Modestring

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.

x-x402'true'

Set to true on unauthenticated accountless x402 quote requests. Without this header, unauthenticated requests return 401 missing_api_key.

Request body

modelstring required

The model to use for completion. The model value may include supported model suffixes, including web search (':online', ':online/<provider>'), memory (':memory', ':memory-<days>'), reasoning visibility (':reasoning-exclude'), thinking variants where listed by the model catalog (':thinking'), and provider routing preferences for eligible models (':fast', ':cheap', ':caching', etc.).

billing_modestring

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.

billingModestring

Alias for billing_mode.

cachingboolean

When true, route to an available provider that is marked as prompt/input-caching capable for the requested provider-selection model. If no usable cache-capable provider exists, the request fails instead of falling back to a non-cache-capable provider. This is provider capability routing only; it does not add cache_control markers, configure cache TTLs, or force a cache write. The model suffixes ':caching', ':cache', and ':cached' request the same behavior.

stickyproviderboolean

Top-level routing control for caching: true. When caching is true, defaults to true and prefers the previously recorded provider for later matching requests from the same API key or session when still usable. Set false to require a cache-capable provider without sticky routing.

stickyProviderboolean

CamelCase alias for top-level stickyprovider. Distinct from prompt_caching.stickyProvider, which controls explicit prompt-cache failover behavior.

streamboolean

Whether to stream the response

service_tier'auto' | 'default' | 'flex' | 'priority'

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.

temperaturenumber

Classic randomness control. Accepts any decimal between 0-2. If omitted, NanoGPT does not force a value and the routed provider/model default applies

max_tokensinteger

Upper bound on generated tokens. If omitted, NanoGPT does not enforce an explicit default and the routed provider/model default applies

top_pnumber

Nucleus sampling. When set below 1.0, trims candidate tokens to the smallest set whose cumulative probability exceeds top_p. Works well as an alternative to tweaking temperature

frequency_penaltynumber

Penalizes tokens proportionally to how often they appeared previously. Negative values encourage repetition; positive values discourage it

presence_penaltynumber

Penalizes tokens based on whether they appeared at all. Good for keeping the model on topic without outright banning words

repetition_penaltynumber

Provider-agnostic repetition modifier (distinct from OpenAI penalties). Values >1 discourage repetition

top_kinteger

Caps sampling to the top-k highest probability tokens per step

top_anumber

Combines top-p and temperature behavior; leave unset unless a model description explicitly calls for it

min_pnumber

Ensures each candidate token probability exceeds a floor (0-1). Helpful for stopping models from collapsing into low-entropy loops

tfsnumber

Tail free sampling. Values between 0-1 let you shave the long tail of the distribution; 1.0 disables the feature

eta_cutoffnumber

Cut probabilities as soon as they fall below the specified tail threshold

epsilon_cutoffnumber

Cut probabilities as soon as they fall below the specified tail threshold

typical_pnumber

Typical sampling (aka entropy-based nucleus). Works like top_p but preserves tokens whose surprise matches the expected entropy

mirostat_mode0 | 1 | 2

Enables Mirostat sampling for models that support it. Set to 1 or 2 to activate

mirostat_taunumber

Mirostat target entropy parameter. Used when mirostat_mode is enabled

mirostat_etanumber

Mirostat learning rate parameter. Used when mirostat_mode is enabled

min_tokensinteger

For providers that support it, enforces a minimum completion length before stop conditions fire

stop_token_idsinteger[]

Numeric array that lets callers stop generation on specific token IDs. Not supported by many providers

include_stop_str_in_outputboolean

When true, keeps the stop sequence in the final text. Not supported by many providers

ignore_eosboolean

Allows completions to continue even if the model predicts EOS internally. Useful for long creative writing runs

no_repeat_ngram_sizeinteger

Extension that forbids repeating n-grams of the given size. Not supported by many providers

custom_token_bansinteger[]

List of token IDs to fully block

logit_biasobject

Object mapping token IDs to additive logits. Works just like OpenAI's version

prompt_logprobsboolean

Requests logprobs on the prompt itself when the upstream API allows it

seedinteger

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.

reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'

Controls reasoning depth and acts as an explicit reasoning-mode signal. Any value other than "none" requests reasoning/thinking behavior. Use "none" to explicitly disable reasoning.

reasoning_delta_field'reasoning_content'

Shorthand for reasoning.delta_field

reasoning_content_compatboolean

Shorthand to force legacy reasoning_content fields in the response

Example request

{
  "model": "minimax/minimax-m2.7",
  "prompt_caching": {
    "ttl": "5m"
  }
}

Response

Chat completion response

idstring

Unique identifier for the completion

objectstring

Object type, always 'chat.completion'

createdinteger

Unix timestamp of when the completion was created

service_tierstring

Service tier used (echoed when provided on the request)