---
title: "POST /talk-to-gpt"
method: POST
path: "/talk-to-gpt"
---

# POST /talk-to-gpt

`POST /talk-to-gpt`

## Request

- Base URL: `https://nano-gpt.com/api`
- URL: `https://nano-gpt.com/api/talk-to-gpt`
- Auth: API key in header `x-api-key`

Legacy endpoint for chat interactions with the GPT model

## Request body

- TalkToGptRequest
  - `prompt` string: The text prompt to send to GPT (optional)
  - `model` string, required: The model to use for generation. The legacy endpoint supports the same model suffix parser for web search and provider routing, including ':caching', ':cache', and ':cached', as Chat Completions.
  - `provider` union: Optional provider override or structured provider routing controls for provider-selection-capable models. A string explicitly selects one provider. An object can set soft order, hard pins, exclusions, sort preference, price caps, fallback behavior, and parameter-capability requirements.
    - string: Provider ID or accepted provider display name/alias.
    - ProviderRoutingObject: Structured per-request provider routing controls. Per-request controls take precedence over saved provider preferences and are not merged with them.
      - `order` string[]: Soft provider preference order. NanoGPT tries these providers first when possible, but this does not hard-pin routing to only these providers. Unknown providers are ignored.
      - `only` string[]: Hard provider pin. NanoGPT restricts routing to these providers and fails instead of silently routing elsewhere. Unknown providers return a structured 400 error with code provider_unknown_provider.
      - `ignore` string[]: Providers to exclude from routing. Unknown providers are ignored.
      - `sort` 'speed' | 'throughput' | 'latency' | 'price' | 'auto' | 'none' | 'default': Routing preference. speed, throughput, latency, and price actively request that strategy. auto, none, and default are accepted to suppress stored/default routing preferences without requesting a provider sort.
      - `quantizations` string[]: Hard allowlist of model weight quantization levels. Providers without matching known quantization metadata are excluded unless unknown is included explicitly.
      - `min_quantization` 'int4' | 'fp4' | 'fp6' | 'int8' | 'fp8' | 'fp16' | 'bf16' | 'fp32': Minimum model weight quantization precision floor. Quantizations are ordered by bit width; integer and floating-point formats with the same bit width are treated as equivalent. unknown is not valid because it cannot be compared to a precision floor.
      - `max_price` object: Optional provider price caps in USD per 1 million tokens. Pricing checks are best-effort when provider pricing is unknown.
        - `prompt` number: Maximum prompt/input price in USD per 1 million tokens.
        - `completion` number: Maximum completion/output price in USD per 1 million tokens.
      - `allow_fallbacks` boolean: When false, disables cross-provider fallback for this request.
      - `require_parameters` boolean: When true, requires the selected provider to support the requested parameters on routes that support parameter-level capability checks.
  - `messages` object[]: Array of previous message objects for context (optional)
    - `role` 'user' | 'assistant', required: The role of the message author
    - `content` string, required: The content of the message

## Response `200`

Talk to GPT response

## Other responses

- `400`: Unexpected error

## Changes

- **2026-11-03** `cc8b07d75689`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/nano-gpt/apis/nanogpt-api/changes/talk-to-gpt/post.md)

---

[API](https://skmtc.dev/nano-gpt/apis/nanogpt-api.md) - [All operations](https://skmtc.dev/nano-gpt/apis/nanogpt-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nano-gpt/apis/nanogpt-api/revisions/cc8b07d75689?raw)
