Use our API
It's compatible with OpenAI's, so apps, libraries and code made for OpenAI work with it. Give them the settings below and they'll use our models. Free during the beta: no sign-up, no key.
What to enter
- Base URL
-
It stays the same when our server moves. If an app asks for the full endpoint instead, it wants
. - API key
Not needed during the beta. If an app insists on one, any made-up text works, like
sk-anything. Never paste a real key from another service.- Model
The ID of one of the models below, like
MODEL_ID.- Provider
If an app asks what kind, choose “Custom” or “OpenAI-compatible”.
Models available now
Loading the list…
A model answers only while a computer that has it is connected.
Examples
To get the answer token by token as it's written, ask for a stream, the same as with OpenAI. In Python:
What works
GET /v1/modelslists the models, with their prices.POST /v1/chat/completionsanswers a conversation, all at once or token by token.
These settings in a request are used:
model- Required: the ID of a model from the list above.
messages- Required: up to 500, each with a
role(system,developer,userorassistant) and textcontent. max_tokensormax_completion_tokens- The longest answer, up to 8,192 tokens; 8,192 if not given.
temperature,top_p- How varied the answer is: temperature from 0 to 2, top_p above 0 and up to 1.
stop- Text, or a list of texts, that ends the answer when written.
streamtruesends the answer token by token. Add"stream_options": {"include_usage": true}to get the token counts at the end. When demand is high an answer may pause for a while: the stream then carries a comment line saying so, and a comment at least every 20 seconds keeps the connection open. OpenAI's libraries skip comment lines.
Only text can be sent for now: images and other attachments are refused. Other OpenAI settings,
like tools or response_format, are ignored.
Answers come in OpenAI's format, token counts (usage) included. Each also has
cost_usd: what it would cost at the model's prices, though nothing is charged during the beta. A
model that thinks before it answers sends its thinking in reasoning_content.
A conversation can be up to 200,000 bytes. With its answer, it has to fit in the model's own conversation limit: 32,768 tokens for Qwen 2.5 0.5B, for example. An answer has no time limit. If the computer writing it stops, or makes no progress for 5 minutes, the answer moves to another computer, which carries on from the words already written: at most twice. If the computer only goes quiet for a while (its connection hiccupping), the answer waits for it, and moves on as soon as another computer has room. An answer that can't be finished within 3 minutes of that comes as an error, and you aren't charged for it.
A moved answer is counted, and costs, as the computer that finished it worked: the words written before the
move are what it read, so they're in usage.prompt_tokens at the reading price, and only the words
it wrote after are in usage.completion_tokens. It costs a little less than an answer that didn't
move.
Errors
Errors come the way OpenAI's do, {"error": {"message": …, "type": …, "code": …}}, with a message
that says what happened. Each code below is shown with its HTTP status.
invalid_request_error400- Something in the request can't be used, like an image, or a conversation that's too long.
model_not_found404- No model has that ID: see the list above.
no_capacity503- No computer that has the model is taking questions right now.
busy503- Every computer running the model is busy, or has no room for a question this long while demand is high. We wait up to 5 seconds for one to be free before saying so. Try again in a few seconds, or send a shorter one.
too_long503- No computer has room for a question this long right now. Send a shorter one, or try again later.
short_of_memory503- The computers that have the model are short of free memory. Try again in a few minutes.
unpriced503- The model has no price yet, so it can't be used.
overloaded503- The answer couldn't be finished: demand was too high to find another computer for it. Try again shortly. You weren't charged for it.
node_failed502- Something went wrong while writing the answer, on more than one computer. Try again. You weren't charged for it.
server_offline503- Our server is offline right now.
server_unreachable502- Our server can't be reached right now.
server_error500- Something went wrong on our server.
A 503 says how many seconds to wait, in its Retry-After header. In a streamed
answer, an error after the stream has begun comes as its last event: the answer couldn't be finished, so
throw away what arrived of it. You aren't charged for it. An answer that isn't streamed and takes more than a
minute starts its reply with spaces, which JSON allows, to keep the connection open; if it then can't be
finished, the reply is an error object instead of an answer. OpenAI's Python library doesn't raise its usual
error for that one, so check for an error field, or stream long answers. A 422 means a setting is
missing or out of range, like max_tokens above 8,192. A plain “Not Found” or “Method Not Allowed”
means the address is wrong: see the base URL above.
Good to know
- Questions are answered on computers that people lend us, and those computers see what you send. Please don't send anything private.
- A computer may answer several questions at once when demand is high, so answers can be slower than from big cloud services.
- During the beta, models, prices and limits may change, and our server is sometimes offline.