From key to first completion.
Five minutes, no SDK required. You need to be an owner or admin of a Webel room with the public API enabled.
1. Create a key
In Webel, open your room's API keys page at app.webel.ai/api-keys (also linked from Settings). Click Create key, give it a name, and optionally set a spend cap in dollars.
- The raw key —
wbl-…— is shown once, at creation. Copy it then; only a hash is stored after that. - If this is the first key in the room, you may be asked to accept the API Terms of Service. It is one click and never asked again.
- Keys expire after 90 days. Revoke and replace on your schedule; revocation is instant.
- A key acts as its own read-only service identity scoped to exactly one room. It cannot act as you, and it cannot touch another room.
2. Make your first call
One POST. The response follows the OpenAI Chat Completions shape.
curl https://api.webel.ai/v1/chat/completions \
-H "Authorization: Bearer $WEBEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{ "role": "user", "content": "What is model routing?" }]
}'
The first call mints a durable conversation in your room. The reply arrives synchronously — typically within seconds.
3. Read the response
{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "…",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "…" },
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 120,
"completion_tokens": 80,
"total_tokens": 200,
"cost_microusd": 1250000,
"model_selected_by": "auto"
},
"webel": { "conversation": "…", "turn": "…", "flavor": "api" }
}
usage.cost_microusd is what the call cost in millionths of a dollar (1250000 = $1.25). usage.model_selected_by tells you whether the model was pinned by you or chosen by Webel's router. webel.conversation is the thread id — keep it to continue the conversation.
4. Continue the conversation
Pass the conversation id back as conversation. The thread keeps its full history server-side, so each follow-up sends only the new user message.
{
"model": "auto",
"conversation": "<webel.conversation from step 3>",
"messages": [{ "role": "user", "content": "Now compare it with static routing." }]
}
Using an OpenAI SDK
Because the wire format is OpenAI-compatible, existing SDKs work with two changes: the base URL and the key.
from openai import OpenAI
client = OpenAI(
api_key=os.environ["WEBEL_API_KEY"], # wbl-…
base_url="https://api.webel.ai/v1",
)
resp = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Summarize this quarter."}],
)
print(resp.choices[0].message.content)
Webel-specific fields ride along in every response body under usage.model_selected_by and webel.*; SDKs ignore unknown fields, so nothing breaks.
Troubleshooting
- 401 unauthorized. Missing or malformed bearer header, or the key was revoked or expired (keys live 90 days).
- 403 the public API is disabled for this room. Ask the room owner to enable the public API for the room, then retry.
- 400 no user message in `messages`. The request must include at least one message with
"role": "user". - 402 payment required. The key hit its spend cap. Raise it on the keys page or let the period reset.
Full status-code and error-body contract: Errors.