Skip to content

API keys are not open yet. These docs describe the API as it will work when keys open, so you can plan your integration now.

Docs

Rate limits

Each key has a requests-per-minute limit and optional spend limits per day and per month.

Requests per minute

Every key has its own limit on requests per minute: 60 unless you set another, up to 1,000. You set it when you create the key and can change it later under API in the app.

Every answer tells you where you stand:

HeaderMeaning
X-RateLimit-LimitRequests allowed per minute for this key.
X-RateLimit-RemainingRequests left in the current minute.
X-RateLimit-ResetWhen the minute resets, in Unix seconds.

curl

curl -s -o /dev/null -D - https://ewpire.com/api/v1/models \
  -H "Authorization: Bearer $EWPIRE_API_KEY"

Over the limit, you get 429 rate_limit_exceeded with a Retry-After header in seconds. The OpenAI SDKs wait and retry by themselves.

import OpenAI from "openai";

// The SDK retries a 429 after Retry-After; raise maxRetries for bursty jobs.
const client = new OpenAI({
  baseURL: "https://ewpire.com/api/v1",
  apiKey: process.env.EWPIRE_API_KEY,
  maxRetries: 5,
});

Spend limits

A key can also have a daily and a monthly spend limit in credits. A request that would go over it is refused with 429 spend_limit_exceeded and x-should-retry: false, and nothing is charged.

Limits are checked against the reservation a request makes before it runs (see Usage), so a request can be refused slightly before the limit is reached.