Skip to content
Top up with USDC on Base and Robinhood Chain. New accounts start with free credit. See pricing →

API reference

Docs

Call open-weights models through an OpenAI-compatible API. Point any OpenAI SDK at one base URL and keep your code.

Base URLhttps://openmodel.club/v1

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/v1 and pass the key.
  • Pick a model id from GET /v1/models and send a chat completion. The samples use MODEL_ID as 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 user message as image_url parts, and must be data: 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_tokens and 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
  }'
Request body for POST /v1/chat/completions
ParameterTypeDescription
modelstring, requiredA model id from GET /v1/models. An unknown or retired id is refused 404 model_not_found.
messagesarray, requiredThe conversation, OpenAI shape: system, user, assistant and tool roles. At least one message.
max_tokensintegerUpper bound on generated tokens, reasoning included. The default and the ceiling come from the model's catalog entry.
temperaturenumberSampling temperature, 0 to 2.
top_pnumberNucleus sampling, 0 to 1.
stopstring or arrayUp to four sequences that end generation.
seedintegerBest-effort deterministic sampling.
streambooleanSend the reply as server-sent events. See Streaming.
stream_options.include_usagebooleanWith stream, add a final chunk that carries usage.
toolsarrayFunctions the model may call. See Tool calling.
tool_choicestring or objectauto, none, required, or a named function.
reasoning_effortstringlow, medium or xhigh (high is read as xhigh, minimal as low), for models that reason. See Reasoning.
Response fields
FieldTypeDescription
choices[].messageobjectThe reply: content, plus tool_calls and reasoning_content when present.
choices[].finish_reasonstringstop, length or tool_calls.
usage.prompt_tokensintegerInput tokens, cached ones included.
usage.completion_tokensintegerOutput tokens, reasoning included. This is what you are billed for as output.
usage.total_tokensintegerThe 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 answer

08

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 codes and error codes
StatuscodeWhen
400bad_requestThe body failed validation: a missing field, a bad value, a remote image URL.
400too_longThe prompt is longer than the model's context window.
401bad_keyThe key is missing, malformed or revoked.
402out_of_creditThe request's worst case does not fit in your balance. Top up in the console.
403not_in_apiA Bearer key was sent to a route that is not part of the API.
404model_not_foundNo live model has that id.
413too_largeThe body is over 4 MB.
429rate_limit_exceededThe key went over its rate limit. Wait for Retry-After.
500server_errorSomething failed on our side. The body carries a rid to quote to support.
502model_unreachableThe model's server is down or restarting. Retry with backoff.
502model_errorThe model's server failed while answering.
504slowThe 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_tokens of output plus the prompt. When that does not fit in your balance, it is refused 402 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.
How a request is priced
MeterUnitNotes
Inputper million tokensPrompt tokens not served from the prefix cache.
Cached inputper million tokensPrompt tokens served from the prefix cache, at a lower price.
Outputper million tokensGenerated tokens, reasoning included.