ExaConsole Sign inGet an API key

Quickstart

The Exa API follows the chat completions format, so the official OpenAI libraries work when you change the base address and the key.

  1. Create an API key in the console. It is shown once; copy it.
  2. Add credit (from $5).
  3. Call the API:
curl https://openwist-poc-iiv3.onrender.com/v1/chat/completions \
  -H "Authorization: Bearer $EXA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "exa-sage",
    "messages": [
      {"role": "system", "content": "You are a patient maths tutor."},
      {"role": "user", "content": "Explain why the sum of two odd numbers is even."}
    ]
  }'

Base address: https://openwist-poc-iiv3.onrender.com/v1

Authentication

Send your key as a bearer token on every request: Authorization: Bearer exa_sk_.... Keys belong to an organisation and are created, limited and revoked in the console.

Keep keys secret. Never put a key in a web page, a mobile app or a public repository. Call the API from your server. If a key leaks, revoke it in the console; it stops working immediately.

Models and pricing

GET /v1/models lists them. The three levels cost more the more work a request takes, so use the cheapest level that does the job. The old name exa-god still works and means exa-apex.

ModelBest forInput / 1MOutput / 1M
exa-swiftQuick everyday answers, extraction and classification$0.04$0.16
exa-sageReasoning, writing and code (default)$0.20$1.00
exa-apexPlans, runs and checks its own work on the hardest tasks$1.00$4.00

Chat completions

POST /v1/chat/completions

FieldTypeNotes
modelstringOne of the models above. Defaults to exa-sage.
messagesarrayUp to 100 messages with roles system, user and assistant. The last must be from the user. Content is text, or a list of text parts.
streambooleanSend the answer as server-sent events as it is written.
stream_options.include_usagebooleanAdd a final event with token counts.
max_tokensintegerStops the answer after about this many tokens and reports finish_reason: "length". Without it, Exa finishes the answer on its own.

The response has choices[0].message.content, finish_reason and usage (prompt_tokens, completion_tokens, total_tokens). Tools, web search and file features of the Exa app are not part of the API; the API returns words for the words it is given.

Streaming

Set stream: true. Events are data: {...} lines in the usual chunk format and end with data: [DONE]. If Exa has to continue an answer behind the scenes (for example after a model reaches its own output limit) the words simply keep arriving; you do not need to do anything.

Rate limits

Limits protect your budget and keep Exa fast for everyone. Each is set in the console.

LimitScopeDefault
Tokens per minuteKey60,000
Tokens per minute (pool)Organisation, all keys together200,000
Requests per minuteKeyOff
Tokens per dayKey, resets at midnight Africa/NairobiOff
Monthly spend capKey and organisationOff

Responses carry x-ratelimit-limit-tokens, x-ratelimit-remaining-tokens and, when set, the request equivalents. When a limit stops a call you get a 429 with a Retry-After header in seconds.

Errors

Errors are JSON: {"error": {"message": "...", "type": "...", "code": "..."}}.

StatusCodeMeaning
400invalid_requestThe request is malformed: missing messages, a wrong role, or the last message is not from the user.
401invalid_api_keyThe key is missing, mistyped or revoked.
402insufficient_creditThe organisation has no credit left.
403account_suspendedThe organisation is suspended. Contact support.
404model_not_foundThe model name does not exist.
413context_length_exceededThe messages are too long (400,000 characters at most).
429rate_limit_tokens / rate_limit_requests / rate_limit_org_tokensA per-minute limit was reached. Wait for Retry-After seconds.
429daily_tokens_reached / monthly_cap_reached / key_monthly_cap_reachedA budget was reached; Retry-After says when it resets.
429server_busyExa is at full capacity and the waiting line is full. Nothing was charged; retry after Retry-After seconds.
503overloadedExa could not answer just now. Nothing was charged; retry shortly.

High-volume guide (launches and busy products)

Exa is designed so that a busy hour slows answers down a little rather than breaking them. To get the most from it:

  • One key per app, environment or customer. Limits, usage and revocation then work per key, and one noisy client cannot starve the others.
  • Size the limits. Estimate tokens per user per minute (a typical answer is 300 to 800 tokens) and set the key and the organisation pool above the total.
  • Always retry 429 and 503. Wait Retry-After seconds plus a random second. The example below does this.
  • Stream for long answers. People see words immediately while the rest is written.
  • Plan big days. Write to support@openwist.com with the traffic you expect and the date so capacity and priority can be arranged ahead.
import random, time
from openai import OpenAI, RateLimitError, APIStatusError

client = OpenAI(api_key="exa_sk_...", base_url="https://openwist-poc-iiv3.onrender.com/v1", max_retries=0)

def ask(messages, model="exa-sage", tries=6):
    for attempt in range(tries):
        try:
            return client.chat.completions.create(model=model, messages=messages)
        except RateLimitError as e:                      # 429: wait as long as the server says
            wait = int(e.response.headers.get("retry-after", 5))
        except APIStatusError as e:
            if e.status_code not in (500, 502, 503, 504):
                raise
            wait = int(e.response.headers.get("retry-after", 2 ** attempt))
        time.sleep(wait + random.random())              # a little jitter so many clients do not retry in the same second
    raise RuntimeError("Exa stayed busy; try again later")

Billing and credit

Your organisation holds a prepaid balance in US dollars. Each successful call is charged by tokens in and out at the model's price. Add credit in the console (card, via Paystack). Failed calls and calls stopped by a limit are free. When the balance is zero, calls return 402 insufficient_credit.

Developer tools

The console has a Playground to run a prompt on any model with your own key (the key stays in your browser and is never stored), a Developer tools page with copy-paste setup, and a Datasets page where you can export your usage and billing history as CSV.

Openwist also publishes Modelfile Lint, an open-source checker for Ollama Modelfiles:

pip install owist-modelfile-lint