Your first request
Install the official Python SDK withpip install openai, create an API key and set it as NANOGPT_API_KEY in your environment. Keep the key on your server, outside source control. Pick the example for how you pay.
Use the exact SDK base URL https://api.nano-gpt.com/api/v1. The SDK appends /chat/completions, producing POST /api/v1/chat/completions. Do not append that endpoint to base_url yourself.
Use my Pro allowance
Set the key’s Billing mode to Subscription only (on the API page, in the key’s options). Requests then count against your Pro allowance and never use balance. This example uses GLM 5.3, which Pro includes at 1×.GET /api/subscription/v1/models lists every model Pro includes.
Use my balance
Add balance and use a key whose billing mode is not Subscription only (a Subscription only key refuses balance requests).billing_mode: "paygo" bills the request to balance, even if you also have Pro.
Explore the API
- Chat Completions:
POST /api/v1/chat/completions - Responses:
POST /api/v1/responses - Messages:
POST /api/v1/messages - Image generation:
POST /api/v1/images/generations - Video generation: job submission and polling
- API Hosts: direct API host, partner domains and runtime limits
- Private Mode: local encryption proxy
x-x402: true on the initial unauthenticated quote request. All x402 rails, including XNO, were removed on 2026-11-20; the header and API paths retain historical names for Lightning L402. Check GET /api/v1/x402/endpoints for the current supported matrix.