Documentation Index
Fetch the complete documentation index at: https://docs.nano-gpt.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Partner Auth lets your backend authenticate one of your users to NanoGPT without giving you a NanoGPTsessionUUID or a NanoGPT API key.
You send a short-lived JWT signed by your backend. NanoGPT verifies it, maps your user ID to a normal NanoGPT account behind the scenes, and runs requests against that linked account.
The same partner user always maps to the same NanoGPT account.
Partner Auth is available by request. Contact NanoGPT to configure your partner slug, JWT audience, public signing key, redirect allowlist, and optional commercial settings before production use.
How It Works
Your backend owns the private key. NanoGPT stores only the public key.What NanoGPT Configures
Before launch, NanoGPT configures:- Your partner slug, for example
example - Your JWT audience, for example
nanogpt-partner-api:example - Your public signing key and key ID, for example
example-2026-04 - Allowed browser redirect URLs for SSO
- Optional referral revenue share
- Optional partner tiers for discounts and request-access allowance rules
JWT Requirements
Every partner-authenticated request uses:- Use
ES256orRS256. exp - iatmust be at most 5 minutes.jtimust be unique per request token.submust be your stable user identifier, opaque to NanoGPT.- Do not send emails, names, or other personal data as
sub. - NanoGPT stores
HMAC-SHA256(sub), not the rawsub. - Create JWTs on your backend only. Never sign tokens in the browser.
Scopes
Use the smallest scope needed for each request.| Scope | Purpose |
|---|---|
request:create | Create AI requests such as chat, image, video, or audio requests |
session:web | Create a one-time browser login link |
balance:read | Read the linked user’s NanoGPT balance |
deposit:create | Create a deposit or top-up request |
usage:read | Read usage for the JWT sub |
usage:read:any | Backend-only scope to read usage for another subject query param |
Send AI Requests
Use a partner JWT instead of a NanoGPT API key.sub.
See also: Chat Completion, Image Generation, and Video Generation.
Check User Balance
sessionUUID.
Initiate A Top-Up
For native Nano deposits, read the linked user’snanoDepositAddress from the balance response and show that address to the user. See Check User Balance.
For invoice-style payment methods, create a deposit for the linked user with the ticker route:
sub and returns deposit details for that linked account. For ticker-specific limits and supported payment methods, see Crypto Deposits.
Browser SSO
Use browser SSO when you want to send a user from your product into NanoGPT already signed in as the linked account. Create a one-time login link:Read User Usage
Read usage for the JWTsub:
subject differs from the JWT sub, the JWT must also include:
usage:read:any only from trusted backend services.
Funding Options
NanoGPT supports user-funded usage by default:- Each linked user has their own NanoGPT balance.
- Your product can show the user’s balance and top-up options.
- If the linked user has no balance, paid requests return the normal insufficient-balance response.
- If configured, your partner account can earn referral revenue from user-funded top-ups.
free: no discountbasic: 5% discountpremium: 10% discount
Request-Access Funding Features
Some funding options require NanoGPT approval and explicit configuration before they can be used:- Free starter prompts or free starter credits
- Partner-funded daily, weekly, monthly, or one-time allowances
- Custom per-tier discounts
- Partner settlement for sponsored usage
- one-time signup allowance
- weekly allowance
- monthly allowance
Error Handling
Common responses:| Status | Meaning |
|---|---|
401 | Missing, invalid, expired, replayed, or unauthorized partner JWT |
402 | Linked user needs balance before the request can run |
403 | JWT is valid but missing the required scope |
429 | Too many requests or too many auth failures |
500 | NanoGPT could not complete the server-side operation |
429 or 500.
Security Checklist
- Sign JWTs only on your backend.
- Keep private keys in your secret manager.
- Use short-lived JWTs, max 5 minutes.
- Use a unique
jtiper request token. - Use opaque stable user IDs as
sub. - Never put PII in
sub. - Request only the scopes needed for the operation.
- Do not expose
usage:read:anyordeposit:createfrom browser code. - Rotate keys periodically and revoke old keys after rollout.
Minimal Backend Flow
- User opens your AI feature.
- Your backend signs a JWT with
sub = your user idand the needed scope. - Your backend calls NanoGPT with
Authorization: Bearer <jwt>. - NanoGPT verifies the JWT and maps the user to a linked NanoGPT account.
- NanoGPT runs the request, checks balance, applies configured partner discount, and records usage.
- Your product renders the result to the user.