Skip to main content

Your first request

Install the official Python SDK with pip 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.
The request ID helps support find a failed request. Save it with your application logs. For streaming, errors, usage and tool calls, copy the tested Quickstart example.

Explore the API

For selected endpoints, you can also use Accountless Lightning L402 API Payments to receive a payment quote without an account or API key by including 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.