01
Quickstart
Three steps from nothing to a first reply.
- Sign in to the console and create an API key. It starts with
om_live_and is shown once. - Point an OpenAI SDK at
https://openmodel.club/v1and pass the key. - Pick a model id from
GET /v1/modelsand send a chat completion. The samples useMODEL_IDas a placeholder.
Anything that speaks the OpenAI Chat Completions API works: the official Python and JavaScript SDKs, LangChain, LlamaIndex, or plain HTTP.
from openai import OpenAI
client = OpenAI(
base_url="https://openmodel.club/v1",
api_key="om_live_...",
)
resp = client.chat.completions.create(
model="MODEL_ID", # any id from GET /v1/models
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)02
Authentication
Every request carries a key in the Authorization header: Authorization: Bearer om_live_....
Create and revoke keys in the console. A revoked key stops working at once; its usage history stays.
export OPENMODEL_API_KEY="om_live_..."
curl https://openmodel.club/v1/models \
-H "Authorization: Bearer $OPENMODEL_API_KEY"03
List models
GET /v1/models returns the models you can call, as an OpenAI list object. Use the id of an entry as model in a request.
The catalog is open-weights models we host on our own GPUs, picked from what is trending on Hugging Face. It changes over time, so read ids from this endpoint rather than hard-coding them.
Context window, output limit and prices are set per model. See the models page for each entry.
curl https://openmodel.club/v1/models \
-H "Authorization: Bearer $OPENMODEL_API_KEY"04
Chat completions
POST /v1/chat/completions generates the next message in a conversation. Request and response follow the OpenAI shape.
- Parameters not listed below are dropped, not forwarded.
- Images go in a
usermessage asimage_urlparts, and must bedata:URLs. Remote URLs are refused. At most 4 images per request, on models that accept images. - The request body may be at most 4 MB.
max_tokensand the context window come from each model's catalog entry, not a global constant.
curl https://openmodel.club/v1/chat/completions \
-H "Authorization: Bearer $OPENMODEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"messages": [
{"role": "system", "content": "Answer in one sentence."},
{"role": "user", "content": "What is a token?"}
],
"max_tokens": 256,
"temperature": 0.7
}'| Parameter | Type | Description |
|---|---|---|
model | string, required | A model id from GET /v1/models. An unknown or retired id is refused 404 model_not_found. |
messages | array, required | The conversation, OpenAI shape: system, user, assistant and tool roles. At least one message. |
max_tokens | integer | Upper bound on generated tokens, reasoning included. The default and the ceiling come from the model's catalog entry. |
temperature | number | Sampling temperature, 0 to 2. |
top_p | number | Nucleus sampling, 0 to 1. |
stop | string or array | Up to four sequences that end generation. |
seed | integer | Best-effort deterministic sampling. |
stream | boolean | Send the reply as server-sent events. See Streaming. |
stream_options.include_usage | boolean | With stream, add a final chunk that carries usage. |
tools | array | Functions the model may call. See Tool calling. |
tool_choice | string or object | auto, none, required, or a named function. |
reasoning_effort | string | low, medium or xhigh (high is read as xhigh, minimal as low), for models that reason. See Reasoning. |
| Field | Type | Description |
|---|---|---|
choices[].message | object | The reply: content, plus tool_calls and reasoning_content when present. |
choices[].finish_reason | string | stop, length or tool_calls. |
usage.prompt_tokens | integer | Input tokens, cached ones included. |
usage.completion_tokens | integer | Output tokens, reasoning included. This is what you are billed for as output. |
usage.total_tokens | integer | The sum of the two. |
05
Streaming
With "stream": true the reply arrives as server-sent events (text/event-stream). Each event is a data: line holding one chat.completion.chunk, followed by a blank line.
The stream ends with data: [DONE], which is not JSON. Lines starting with : are keep-alive comments; ignore them.
Set stream_options.include_usage to get one last chunk before [DONE] with empty choices and the request's usage.
data: {"id":"chatcmpl-1","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"Hel"}}]}
data: {"id":"chatcmpl-1","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"lo!"},"finish_reason":"stop"}]}
data: {"id":"chatcmpl-1","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":9,"completion_tokens":3,"total_tokens":12}}
data: [DONE]06
Tool calling
Describe functions in tools with a JSON Schema for their arguments. When the model wants one, the reply has finish_reason: "tool_calls" and a tool_calls list.
Run the function yourself, then send its result back as a tool message with the matching tool_call_id and call again.
When streaming, tool calls arrive as deltas keyed by index; concatenate each call's arguments string across chunks.
{
"model": "MODEL_ID",
"messages": [{"role": "user", "content": "Weather in Lisbon?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Current weather for a city.",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}],
"tool_choice": "auto"
}07
Reasoning
Models that think before answering return their reasoning separately from the answer: message.reasoning_content on a full reply, delta.reasoning_content on a stream.
reasoning_effort sets how much they think: low, medium or xhigh. high is accepted as xhigh and minimal as low; any other value is refused with 400. Models that do not reason ignore it.
Reasoning tokens are billed as output and count toward max_tokens.
resp = client.chat.completions.create(
model="MODEL_ID",
messages=[{"role": "user", "content": "Is 391 prime?"}],
reasoning_effort="low",
)
msg = resp.choices[0].message
print(getattr(msg, "reasoning_content", None)) # the thinking
print(msg.content) # the answer08
Errors
A failed request returns a non-2xx status and an error object: {"error":{"code","message"}}. code is stable and safe to branch on, and message is readable text you may show to people.
Retry 429, 502 and 504 with backoff. Do not retry 400, 401, 402, 404 or 413 unchanged.
{
"error": {
"message": "The API credit is used up. Add credit on the API platform.",
"code": "out_of_credit"
}
}| Status | code | When |
|---|---|---|
| 400 | bad_request | The body failed validation: a missing field, a bad value, a remote image URL. |
| 400 | too_long | The prompt is longer than the model's context window. |
| 401 | bad_key | The key is missing, malformed or revoked. |
| 402 | out_of_credit | The request's worst case does not fit in your balance. Top up in the console. |
| 403 | not_in_api | A Bearer key was sent to a route that is not part of the API. |
| 404 | model_not_found | No live model has that id. |
| 413 | too_large | The body is over 4 MB. |
| 429 | rate_limit_exceeded | The key went over its rate limit. Wait for Retry-After. |
| 500 | server_error | Something failed on our side. The body carries a rid to quote to support. |
| 502 | model_unreachable | The model's server is down or restarting. Retry with backoff. |
| 502 | model_error | The model's server failed while answering. |
| 504 | slow | The reply took too long and was stopped before it arrived. |
09
Rate limits
Limits apply per key. Your current limits are shown in the console.
Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. Over the limit, you get 429 rate_limit_exceeded with a Retry-After header in seconds; wait that long before retrying.
Repeated requests with an invalid key are limited per IP address.
10
Billing
You pay per token, at each model's price per million input, cached input and output tokens. Prices are on the models page and in the console.
- A request is charged when it ends, from our server's token counts, rounded up to $0.000001.
- Before it runs, a request reserves its worst case:
max_tokensof output plus the prompt. When that does not fit in your balance, it is refused402 out_of_credit. Unused reserve is released at the end. - Top up with USDC on Base or Robinhood Chain from the console. Credit lands after the transfer confirms on-chain.
- Credit does not expire.
- New accounts start with a small free credit.
| Meter | Unit | Notes |
|---|---|---|
| Input | per million tokens | Prompt tokens not served from the prefix cache. |
| Cached input | per million tokens | Prompt tokens served from the prefix cache, at a lower price. |
| Output | per million tokens | Generated tokens, reasoning included. |