Quickstart
Go from zero to your first AI request in minutes.
1. Create an account
Register with your email and password. You'll receive a free starting balance to start experimenting.
curl -X POST https://api.usequota.ai/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "your-secure-password"}'Response:
{
"user": { "id": "...", "email": "you@example.com", "balance": 1000000 },
"session_token": "sess_..."
}Balance is returned in micro-dollars (1,000,000 = $1.00). New accounts receive a free starting balance.
2. Create an API key
Use your session token to create an API key. The key is only shown once — save it somewhere safe.
curl -X POST https://api.usequota.ai/developers/keys \
-H "Authorization: Bearer sess_..." \
-H "Content-Type: application/json" \
-d '{"name": "My first key"}'Response:
{
"id": "...",
"name": "My first key",
"key": "sk-quota-xxxxxxxxxxxxx",
"billing_mode": "developer",
"created_at": "..."
}POST /developers/apps.3. Set up environment variables
Create a .env file in your project root. The variables you need depend on your billing mode.
Developer-pays mode (simple)
Your account balance is charged for all API calls. Just one variable is needed:
QUOTA_API_KEY=sk-quota-...User-pays mode (full OAuth)
Each end-user pays from their own balance. You'll need OAuth credentials from POST /developers/apps (see Authentication):
QUOTA_API_KEY=sk-quota-...
QUOTA_CLIENT_ID=quota_client_...
QUOTA_CLIENT_SECRET=quota_secret_...
QUOTA_BASE_URL=https://api.usequota.ai| Variable | Description |
|---|---|
QUOTA_API_KEY | Your secret API key (from step 2). Never expose this client-side. |
QUOTA_CLIENT_ID | OAuth client ID for user-pays apps. Used to initiate the OAuth flow. |
QUOTA_CLIENT_SECRET | OAuth client secret. Used server-side to exchange authorization codes for tokens. |
QUOTA_BASE_URL | The Quota API base URL. If using Next.js, prefix with NEXT_PUBLIC_ to make it available in browser code. |
4. Install the OpenAI SDK
Quota is OpenAI-compatible, so you can use the official OpenAI SDK:
npm install openai5. Make your first request
Point the OpenAI SDK at Quota and use your API key:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.usequota.ai/v1",
apiKey: process.env.QUOTA_API_KEY,
});
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello!" }],
stream: true,
});
for await (const chunk of response) {
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}6. Check your balance
Every response includes quota metadata with your remaining balance. You can also check it directly:
curl -H "Authorization: Bearer $QUOTA_API_KEY" \
https://api.usequota.ai/v1/balanceResponse:
{
"balance": 985000,
"plan": "free",
"user_id": "bc9aac4f-...",
"billing_mode": "developer"
}Balance is in micro-dollars. 985,000 = $0.985.
Common errors
| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing or invalid API key |
| 402 | insufficient_credits | Insufficient balance — purchase more via Stripe checkout |
| 429 | rate_limit_exceeded | Too many requests (default: 100/min) |
Next steps
- API keys & OAuth
- Chat API & models
- Funding & balances
- Developer vs user billing
- Core SDK — framework-agnostic client for Node.js, Deno, Bun, Cloudflare Workers, and more
- Next.js SDK — React hooks, components, and route handlers for Next.js apps
- Webhooks