Documentation

Everything you need to call models on Cleum. If you can call the OpenAI or Claude API, you already know how.

Introduction

Cleum exposes two compatible APIs behind one key and one balance. Base URLs:

APIBase URLUse with
OpenAI-compatiblehttps://cleum.online/v1OpenAI SDKs, LangChain, LlamaIndex, Vercel AI SDK, any HTTP client
Claude-compatiblehttps://cleum.onlineAnthropic SDKs and tools that accept a custom Anthropic base URL

Quickstart

1. Sign in with Google. 2. Create a key on the API keys page. 3. Pick a model id from the catalog. 4. Send a request:

from openai import OpenAI

client = OpenAI(api_key="clm_your_key", base_url="https://cleum.online/v1")

response = client.chat.completions.create(
    model="claude-sonnet-5-5",
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(response.choices[0].message.content)

Authentication

Send your key in either header. Both work on every endpoint.

Shell
Authorization: Bearer clm_your_key
# or
x-api-key: clm_your_key

Keys start with clm_. A key is shown once when you create it and is stored only as a hash. You can have up to 10 active keys. Revoking a key takes effect within seconds.

Chat completions

POST/v1/chat/completions

Follows the OpenAI Chat Completions format. Supported request fields:

FieldNotes
modelRequired. A model id from GET /v1/models.
messagesRequired. Roles: system, user, assistant, tool. Content may be text or an array with images and files (see Images and files).
streamSet true for server-sent events. Add stream_options.include_usage to receive a final usage chunk.
temperature, top_pSampling controls.
max_tokens, max_completion_tokensUpper bound on generated tokens. Capped at the model's maximum output.
stop, seed, presence_penalty, frequency_penalty, logit_biasPassed through to the model.
response_formatFor example {"type": "json_object"} on models that support it.
reasoning_effortlow, balanced, high or max (medium is accepted as balanced). Only used by models that support reasoning.
tools, tool_choiceOnly on models marked as supporting tool calling.

The response is a standard chat completion object. Reasoning models add message.reasoning_content. Usage is reported in usage and is what you are billed for.

Messages (Claude)

POST/v1/messages

Follows the Claude Messages format. Point the Anthropic SDK at https://cleum.online.

import anthropic

client = anthropic.Anthropic(api_key="clm_your_key", base_url="https://cleum.online")

with client.messages.stream(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    system="You are concise.",
    messages=[{"role": "user", "content": "Explain TCP in two sentences."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

Supported: system, text, image, document, tool_use and tool_result content blocks, tools, tool_choice, max_tokens (required), temperature, top_p, stop_sequences, stream and thinking. Streaming emits the standard events: message_start, content_block_start, content_block_delta, content_block_stop, message_delta and message_stop.

Tool use works on this endpoint too (see Tool calling below) on models marked with the tool icon.

List models

GET/v1/models   No authentication required.

Returns every available model with pricing (the price you are charged, the original list price, and any active offer), context length, modalities, tier and capabilities. GET /v1/models/{id} returns one model.

JSON
{
  "object": "list",
  "data": [{
    "id": "claude-sonnet-5-5",
    "object": "model",
    "owned_by": "Developer",
    "context_length": 131072,
    "max_output_tokens": 8192,
    "pricing": { "input_per_million": 0.375, "output_per_million": 1.125, "original_input_per_million": 0.5, "original_output_per_million": 1.5, "currency": "USD" },
    "offer": { "name": "Launch offer", "percent_off": 25 },
    "input_modalities": ["text", "image", "file"],
    "output_modalities": ["text"],
    "supports_thinking": true,
    "supports_tools": true
  }]
}

Streaming

Set "stream": true. Tokens arrive as server-sent events as they are generated. Cleum sends data from the first token with no buffering. Always read the stream until data: [DONE] (OpenAI format) or message_stop (Claude format). If you close the connection early you are billed for what was generated so far.

Thinking models

Models marked with the reasoning icon can think before answering. On chat completions, reasoning streams in delta.reasoning_content before the answer in delta.content. Control depth with reasoning_effort: low, balanced, high or max. On the Messages API, send "thinking": {"type": "enabled", "budget_tokens": 4096} (about 2K is low, 8K balanced, 32K high, above that max) and read thinking content blocks. Reasoning tokens are billed as output tokens.

Images and files

Each model lists the inputs it accepts (input_modalities in GET /v1/models): text, image and file for PDFs and documents. Sending an input a model does not accept returns a 400 error with code unsupported_modality.

OpenAI format

JSON
{
  "role": "user",
  "content": [
    { "type": "text", "text": "Summarise this report and describe the chart." },
    { "type": "image_url", "image_url": { "url": "data:image/png;base64,..." } },
    { "type": "file", "file": { "filename": "report.pdf", "file_data": "data:application/pdf;base64,..." } }
  ]
}

Claude format

JSON
{
  "role": "user",
  "content": [
    { "type": "document", "title": "report.pdf", "source": { "type": "base64", "media_type": "application/pdf", "data": "..." } },
    { "type": "image", "source": { "type": "base64", "media_type": "image/png", "data": "..." } },
    { "type": "text", "text": "Summarise this report and describe the chart." }
  ]
}

Files and images must be sent inline as base64 (or an image URL). Requests are limited to 8 MB in total. Image and file tokens are billed as input tokens.

Tool calling

On models marked with the tool icon you can use tools in either format. Sending tools to a model that does not support them returns a 400 error with code unsupported_feature.

OpenAI format

Pass tools and tool_choice to /v1/chat/completions and handle tool_calls exactly as you would with OpenAI. Send results back as messages with role: "tool".

Claude format

Pass tools (name, description, input_schema) and optionally tool_choice (auto, any, tool, none) to /v1/messages. The model answers with a tool_use content block and stop_reason: "tool_use". When streaming, the input arrives as input_json_delta events. Reply with a tool_result block in the next user message.

Python
import anthropic

client = anthropic.Anthropic(api_key="clm_your_key", base_url="https://cleum.online")
tools = [{
    "name": "get_weather",
    "description": "Get the current weather for a city",
    "input_schema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
}]
messages = [{"role": "user", "content": "What is the weather in Paris?"}]

first = client.messages.create(model="claude-sonnet-5-5", max_tokens=1024, tools=tools, messages=messages)
call = next(b for b in first.content if b.type == "tool_use")

messages += [
    {"role": "assistant", "content": first.content},
    {"role": "user", "content": [{"type": "tool_result", "tool_use_id": call.id, "content": "18 C and sunny"}]},
]
final = client.messages.create(model="claude-sonnet-5-5", max_tokens=1024, tools=tools, messages=messages)
print(final.content[0].text)

Only custom tools are supported (not built-in server tools such as web search).

Rate limits

The API allows 4 requests per minute per account, counted across all of your keys. Responses include x-ratelimit-limit-requests and x-ratelimit-remaining-requests. When you exceed the limit you receive HTTP 429 with a Retry-After header in seconds. Retries from the official SDKs honor it automatically.

Errors

OpenAI-format errors look like {"error": {"message", "type", "code"}}. Claude-format errors look like {"type": "error", "error": {"type", "message"}}.

StatusCodeMeaning and what to do
400invalid_requestMalformed body, unsupported field or modality. Fix the request.
400request_rejectedThe model could not process the request, often because the conversation is too long for its context window. Shorten it or check parameters.
401invalid_api_keyMissing, wrong or revoked key.
402insufficient_creditsNo balance left. Credits reset on the 1st, or add funds.
402paid_credits_requiredThe model is a Paid model and your paid balance is empty. Add funds.
404model_not_foundUnknown model id. Call GET /v1/models.
413request_too_largeRequest body exceeds the size limit.
429rate_limit_exceededOver 4 requests per minute. Wait for Retry-After.
503model_busyThe model is currently busy. Retry in a few seconds, or try another model.
503model_unavailableThe model is temporarily unavailable. Retry shortly, or try another model.
504model_timeoutThe model took too long to respond. Retry.

If a stream is interrupted after it has started, an error event is sent in the stream and you are billed only for what was generated.

Credits, tiers and billing

General models can be paid for with free monthly credits or paid credits. Paid models can only be paid for with paid credits and return HTTP 402 with code paid_credits_required when you have none. When a model has an active offer, the discounted price is what you are charged.

Every account gets $10 of free credit each calendar month (UTC); the free balance resets on the 1st and does not roll over. Purchased and referral balances never reset. Each request is charged as input_tokens x input_price + output_tokens x output_price, from free credit first, then permanent balance. Watch your spend live on the Usage page, and top up with Bitcoin, Ethereum or Solana on the Billing page.

Referrals

Share your link from the Referrals page. When someone signs up with it and makes their first successful request, $1 is added to your permanent balance.

Data usage

Conversations from the playground and the API are saved and anonymized, and may be used for future AI training and evaluation. See the Privacy Policy.