One OpenAI-compatible API for 1,171 text, image, video and audio models. Create a key, point your client at the base URL, and send your first request.
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.
Settings for Cline, Kilo Code and OpenCode, plus a first task to check the connection.
Connect your editor or terminal to NanoGPT. Create a key above, then choose your coding tool. Consider a separate key with a spending limit so you can track its usage.
Open Cline settings and choose OpenAI Compatible as the API provider. Enter these values and paste your NanoGPT API key into the API key field.
Base URL
https://nano-gpt.com/api/v1Model ID
openai/gpt-6.1-solIf you use separate Plan and Act configurations, set NanoGPT in both. Start with the tool’s default generation settings.
Cline setup guideThe example uses openai/gpt-6.1-sol. Check its current pricing and your key’s billing mode before starting; browse models to choose another model that supports tools.
Verify the connection
Open a project and send this first task:
First task
Inspect this project and explain how to run its tests. Read the relevant files first. Do not edit files or run commands.You should see file-reading tool calls followed by an explanation. Review any permission requests in your coding tool. Check Usage for the request and its charge.
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.Every endpoint, parameter and error code is in the full API reference.
Pay per request without an account, use MCP clients, or reach NanoGPT over Tor.
Unauthenticated requests get a live 402 quote instead of needing an API key, card or pre-funded balance. Pay with Nano or Base USDC.
Connect NanoGPT to MCP clients such as Claude Code and Cursor with the Model Context Protocol.
Authenticated text and image generation straight from the Tor network, with no exit relay between Tor and NanoGPT. Uses your regular API key.