One OpenAI-compatible API for 1,206 text, image, video, 3D and audio models, plus embeddings. Create a key, point your client at the base URL, and send your first request.
This includes Caching mode (caching: true or a :caching suffix) and pinned providers, and can include saved preferences or routing suffixes. In Chat Completions, prompt_caching or cache_control markers can also switch models with provider selection to Caching mode. Automatic routing and automatic provider caching stay eligible.
Create a key to authenticate your API requests.
No API keys yet
Create a key with the button above, then make your first request.
Send a key as Authorization: Bearer $NANOGPT_API_KEY or x-api-key.
Scripts that only manage model presets (called as presets/<name>) or read subscription usage can use a Management API token instead, which cannot run models or spend your balance. Management API docs
Three steps from a new key to a working call.
Works with the OpenAI SDKs and OpenAI-compatible tools such as Cursor, Cline, Roo, OpenWebUI and LiteLLM. Keep your request shape and set model to a NanoGPT text model ID.
Get an API key
Create one in the API keys section above.
Store it in an environment variable
Examples read the key from NANOGPT_API_KEY and never contain it, so they are safe to copy and share.
export NANOGPT_API_KEY="paste-your-key-here"Send a request
curl https://nano-gpt.com/api/v1/chat/completions \
-H "Authorization: Bearer $NANOGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-6.1-sol","messages":[{"role":"user","content":"Hello!"}]}'You get an OpenAI-style chat completion back; the reply is in choices[0].message.content. The request and its cost appear in Usage. To use another model, pick one from the catalog below.
Client failing on reasoning (thinking) output, as some LiteLLM versions do? Use https://nano-gpt.com/api/v1legacy as the base URL instead.
Browse and search our model catalog. Prefer a dedicated browser? Use /models.
Model catalog
The full searchable catalog loads when you get to it, keeping the API setup view fast.
Recipes for privacy controls, streaming, images and video in Python, JavaScript and cURL.
Code examples
Language-specific examples load when you reach this section.
The main endpoints at a glance.
Authenticate with Authorization: Bearer $NANOGPT_API_KEY or x-api-key. The Batch API covers high-volume asynchronous jobs.
/api/v1/chat/completionsOpenAI-compatible text generation with streaming, tools and vision./api/v1/images/generationsOpenAI-compatible image generation. NanoGPT's native route is POST /api/generate-image./api/generate-videoAsynchronous: returns a runId. Poll /api/generate-video/status with runId and modelSlug until it completes./api/v1/audio/speechOpenAI-compatible speech synthesis./api/v1/audio/transcriptionsOpenAI-compatible transcription./api/v1/embeddingsOpenAI-compatible embeddings./api/v1/rerankRank text documents against a query, returning raw relevance scores and original document indexes./api/v1/rerank-modelsReranking model capabilities and prices in USD per million input tokens.Every endpoint, parameter and error code is in the full API reference.