Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nano-gpt.com/llms.txt

Use this file to discover all available pages before exploring further.

Pay-As-You-Go Billing Override (API)

This override forces a request to be treated as paid (pay-as-you-go), even when the user has an active subscription and the model is subscription-included.

What It Does

  • Forces a request to be treated as paid (pay-as-you-go).
  • Bypasses subscription coverage for that request.
  • Allows saved provider preferences to apply to subscription-included traffic.
  • Does not change which models support provider selection.

When to Use It

Use billing_mode: "paygo" when:
  • A subscriber wants to force pay-as-you-go billing without selecting a provider in the request.
  • A subscriber wants saved provider preferences to apply to subscription-included traffic.
Explicit per-request provider selection already uses pay-as-you-go billing. If a subscriber sends X-Provider for a subscription-included model, the request is charged at the selected provider price and does not need X-Billing-Mode: paygo.

Supported Inputs

Header
  • X-Billing-Mode: paygo (header name is case-insensitive)
  • x-billing-mode is also accepted
Body (all endpoints)
  • "billing_mode": "paygo"
  • Alias: "billingMode": "paygo"
Accepted values (case-insensitive)
  • paygo
  • pay-as-you-go
  • pay_as_you_go
  • paid
  • payg
Precedence: Body value wins if both body and header are present.

API Examples

Example with explicit provider selection:
POST /api/v1/chat/completions
X-Provider: deepinfra
Content-Type: application/json

{
  "model": "openai/gpt-oss-20b",
  "messages": [
    { "role": "user", "content": "Say hello in one sentence." }
  ]
}
Example forcing paygo without explicit provider selection:
POST /api/v1/chat/completions
X-Billing-Mode: paygo
Content-Type: application/json

{
  "model": "openai/gpt-oss-20b",
  "messages": [
    { "role": "user", "content": "Say hello in one sentence." }
  ]
}
Responses:
POST /api/v1/responses
X-Billing-Mode: paygo

{
  "model": "gpt-4o-mini",
  "input": "Hello"
}

Provider Selection Notes

  • Provider selection only works for models that support it.
  • If a model does not support provider selection, X-Provider is ignored.
  • X-Provider explicitly selects a provider for the request.
  • Explicit provider selection is always pay-as-you-go and is charged at the selected provider’s price, including provider-selection markup.
  • For subscription users, sending X-Provider bypasses subscription coverage for that request. You do not need to also send X-Billing-Mode: paygo.
  • You cannot currently force a provider and have that same request count as subscription-included usage.

Subscription and Limits Behavior

When billing_mode: "paygo" is set:
  • The request is not eligible for subscription coverage.
  • Subscription quota is not consumed.
  • Pay-as-you-go balance checks apply as normal.
If subscription.enablePaidModelsApi is false, the request is rejected (same as any other paid API request).

FAQ

Does this affect which models are available? No. It only changes billing eligibility. Model availability is unchanged. Does it force a provider for non-selectable models? No. It only affects billing. Use X-Provider to explicitly select a provider for models that support provider selection. Can I combine this with BYOK? Yes. BYOK still works; paygo override only changes subscription eligibility.