Cake AI logo

by

NanoGPT logo
Cake AI logo
Cake AI
Cake AI logo
Cake AI
Search
 
 
 
 
All conversations

Create

Chat
Studio

Explore

Models
Pricing
AI Apps
Blog

Library

Gallery
Workspace
Usage
API
Suggestions and bugs
Terms

|

Privacy

|

Refunds
Balance
Subscription
Teams
Invitations
Presets
Settings
FAQPartnersPress & mediaBrand assetsBenchmarksEarn

API integration

One OpenAI-compatible API for 1,195 text, image, video and audio models. Create a key, point your client at the base URL, and send your first request.

Guides:

Provider routingPrompt cachingWeb search pricingReferral rules
Referrals: requests billed with provider-selection pricing or markup get no referral discount or commission.

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.

Base URLhttps://cake.nano-gpt.com/api/v1
API docs

API keys

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

Batch API

High-volume asynchronous Chat Completions and Responses API jobs.

Integrations

Use NanoGPT as the model provider in Agent2Agent (A2A) apps.

Partners

Offer NanoGPT models inside your product, with billing handled for you.

Make your first request

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.

  1. 1

    Get an API key

    Create one in the API keys section above.

  2. 2

    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"
  3. 3

    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.

Use NanoGPT in your coding tool

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://cake.nano-gpt.com/api/v1

Model ID

openai/gpt-6.1-sol

If you use separate Plan and Act configurations, set NanoGPT in both. Start with the tool’s default generation settings.

Cline setup guide

The 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.

Authentication error: copy an active NanoGPT key again. For OpenCode, check that NANOGPT_API_KEY is set in the same terminal before launching it.

Model or endpoint not found: copy the exact model ID and base URL above. Do not append /chat/completions to the base URL.

Balance or limit error: check your balance, subscription allowance, and the key’s spending limits and billing mode.

Replies without reading files: check that your selected model supports tools and that your coding tool allows file access.

Still stuck? Contact support with the tool version, model ID, and request ID from Usage. Leave your API key out of the message.

Models

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.

Code examples

Recipes for privacy controls, streaming, images and video in Python, JavaScript and cURL.

Code examples

Language-specific examples load when you reach this section.

API reference

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.

EndpointPathWhat it does
Chat completions
POST
/api/v1/chat/completions
OpenAI-compatible text generation with streaming, tools and vision.
Responses
POST
/api/v1/responses
OpenAI Responses API.
Messages
POST
/api/v1/messages
Anthropic Messages API, for clients such as Claude Code.
Models
GET
/api/v1/models
Model list. Add ?detailed=true for pricing and context limits.
Images
POST
/api/v1/images/generations
OpenAI-compatible image generation. NanoGPT's native route is POST /api/generate-image.
Video
POST
/api/generate-video
Asynchronous: returns a runId. Poll /api/generate-video/status with runId and modelSlug until it completes.
Text to speech
POST
/api/v1/audio/speech
OpenAI-compatible speech synthesis.
Speech to text
POST
/api/v1/audio/transcriptions
OpenAI-compatible transcription.
Embeddings
POST
/api/v1/embeddings
OpenAI-compatible embeddings.

Every endpoint, parameter and error code is in the full API reference.

More ways to connect

Pay per request without an account, use MCP clients, or reach NanoGPT over Tor.

x402: pay per request, no account

Unauthenticated requests get a live 402 quote instead of needing an API key, card or pre-funded balance. Pay with Nano or Base USDC.

Try live demox402 docs

Supported endpoints answer an unauthenticated request with 402 Payment Required and payment.accepted[]. Use the quote-and-complete rails, or replay the request with X-PAYMENT when a wallet signs the payment payload. GET /api/v1/x402/endpoints lists exactly what this deployment accepts.

curl -i https://cake.nano-gpt.com/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4.1-nano","messages":[{"role":"user","content":"Say ok"}],"stream":false}'

MCP

Connect NanoGPT to MCP clients such as Claude Code and Cursor with the Model Context Protocol.

MCP setup guide

Tor onion service

Tor

Authenticated text and image generation straight from the Tor network, with no exit relay between Tor and NanoGPT. Uses your regular API key.

The connection is authenticated and encrypted inside Tor. Onion services use http:// because Tor itself authenticates and encrypts the connection. Copy the address only from an official NanoGPT page.

Onion API base URL

http://nanogpt5wwal7shnauuilouj3gaewmk7lskqxdmxlbfz5ho4tdqeh2id.onion/api/v1

Onion image-generation URL

http://nanogpt5wwal7shnauuilouj3gaewmk7lskqxdmxlbfz5ho4tdqeh2id.onion/api/generate-image

Supported: /models, /chat/completions, /responses and /messages under /api/v1, plus /api/generate-image and its signed recovery URLs. Anonymous payments, free models, video, audio, batches, account routes and the web app are not available over Tor.

cURL through a local Tor proxy

Start Tor first. --socks5-hostname makes cURL resolve the onion address through Tor. The SOCKS port is usually 9050; use 9150 with Tor Browser's proxy.

curl --socks5-hostname 127.0.0.1:9050 \
  -X POST http://nanogpt5wwal7shnauuilouj3gaewmk7lskqxdmxlbfz5ho4tdqeh2id.onion/api/v1/chat/completions \
  -H "Authorization: Bearer $NANOGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2",
    "messages": [{ "role": "user", "content": "Hello through Tor" }]
  }'