Quickstart

Go from zero to your first AI request in minutes.

API-first with dashboard: Quota provides both a web dashboard for account management and a full REST API. Everything you can do in the dashboard is also available via API.

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": "..."
}
Building a user-facing app? If your users should pay for their own AI usage, create an OAuth app instead of using API keys directly. See OAuth setup for details on registering an OAuth client via 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
VariableDescription
QUOTA_API_KEYYour secret API key (from step 2). Never expose this client-side.
QUOTA_CLIENT_IDOAuth client ID for user-pays apps. Used to initiate the OAuth flow.
QUOTA_CLIENT_SECRETOAuth client secret. Used server-side to exchange authorization codes for tokens.
QUOTA_BASE_URLThe 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 openai

5. 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/balance

Response:

{
  "balance": 985000,
  "plan": "free",
  "user_id": "bc9aac4f-...",
  "billing_mode": "developer"
}

Balance is in micro-dollars. 985,000 = $0.985.

Common errors

StatusCodeMeaning
401invalid_api_keyMissing or invalid API key
402insufficient_creditsInsufficient balance — purchase more via Stripe checkout
429rate_limit_exceededToo many requests (default: 100/min)

Next steps