Join Beta

Closed beta

Request early access

We are onboarding a small group of teams running multi-step agentic tasks. Tell us what you are working on and we will be in touch.

Access
By application
Review
Read by the team
Continue to application

Opens a short form in a new tab. Privacy

Model API docs

Model API

Causal Reflection is an OpenAI-compatible chat completions API. It improves agent performance and reliability on long-running, tool-heavy work by adding a reasoning framework that helps agents adapt from their own outcomes—without changing how you call chat completions.

stream: true returns a server-sent event stream. Tool calls use the OpenAI tools and tool_calls shape.

Start here

  1. Create a key on the dashboard. The secret is shown once.
  2. Call POST /v1/chat/completions with Authorization: Bearer, X-Session-Id, and X-Workload.
  3. Send this run's task, then the message that reports the outcome. The pack page shows the message shape for each workload.

The keys page shows the base URL and the model id. The base URL is https://api.basedmodels.com/v1. GET /v1/models lists the model ids.

Call the API

Send the key as Authorization: Bearer. Keep one X-Session-Id for the whole workflow. Set X-Workload on the first call.

curl https://api.basedmodels.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Session-Id: workflow-1" \
  -H "X-Workload: generic" \
  -H "X-Run-Id: run-1" \
  -d '{"model":"glm-5.3-flash:causal-reflection","messages":[{"role":"user","content":"Check whether the daily export finished."}]}'

X-Run-Id can be left off. The same call from Python:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.basedmodels.com/v1",
    api_key="YOUR_KEY",
)

client.chat.completions.create(
    model="glm-5.3-flash:causal-reflection",
    messages=[
        {"role": "user", "content": "Check whether the daily export finished."}
    ],
    extra_headers={
        "X-Session-Id": "workflow-1",
        "X-Workload": "generic",
    },
)

A successful call returns a normal chat completion: id, object, model, choices, and usage.

HeaderWhat it does
X-Session-IdNames a session. The same id and the same key continue it.
X-WorkloadChooses which pack reads the outcome. The first call stores it.
X-Run-IdOptional label. The session page shows it beside the workload.

Sessions

A session is stored for the pair of API key and X-Session-Id. Reuse one id when the same job, customer, ticket, or project should stay consistent across calls. Send this run's task and the message that reports the outcome.

A daily job is the same rule. Hard-code one X-Session-Id, such as daily-export, and the same API key on every run. Each day sends that day's task and the tool result. A new id starts a new session.

Leave X-Session-Id off and a new prompt starts a session id such as sess_…. The API resumes a session without the header only when today's messages still begin with the stored transcript and that session was updated in the last 24 hours. A saved id still loads after that window.

X-Run-Id is a label on the session. Changing it changes the label only. The session stays keyed on X-Session-Id.

Choose a pack

X-Workload chooses the pack. Set it on the first call. Later calls on this session use the stored choice, including when the header is absent.

If the header is absent on the first call, the API guesses from the tools. Coding tool names such as read_file or apply_patch select coding. Any other tools select tool-use. No tools select generic.

For a daily job, send generic. The tool result can be a signal: line or a top-level outcome, status, ok, or is_error. The field table and the other packs are on the pack page.

PackUse casesSend it whenWhere the outcome is
genericDaily jobs, per-customer or per-ticket agents, workflows with a simple success/failure signalThe result is a signal: line or a small JSON objectThe tool result after the assistant tool call
medicalMulti-step billing over one case, chart, or patientLater questions need facts already taken from that recordThe tool call's summary and answer; the tool result's outcome
codingFixing tests, applying patches, iterating until the suite passesThe run is a test suite or a file editThe test footer, or the edit result
tool-useAgents that call APIs or tools—search, booking, CRM updatesThe agent calls tools and a normal result means successThe tool result after the assistant tool call
queryDatabase or SQL agents that inspect schema and answerThe agent inspects a database and then answersA JSON QUERY action, then the next user message
forecastTraining or backtesting loops with a scored closed periodA script is fit, then a year closes with a scoreThe assistant command, then a later user message
cohortClinical or research study agents probing columns, survival, or schemaA study prints columns, survival, or a failed probeThe latest user message
strategyMulti-round games or sims with named opponents and per-round scores (poker, trading, negotiations, competitive play)A hand names an opponent and a chip changeThe latest user message
registrySignal or spectrum scanning agents that remember peaks or centersA scan prints detected peaksThe latest user message

Missing or unknown X-Workload is not an error; the first call stores a guessed pack.

A pack reads only its own shape. A turn that does not match the pack leaves the session unchanged.

Messages

Send the messages the model should see on each call. When you reuse a session id, you do not need to resend the full conversation every time for the workflow to stay consistent. Include earlier messages when the model should see that text.

Images

The Model API accepts images. Put them in a message content list next to the text. The URL is https or a base64 data URI. The types are png, jpeg, jpg, gif, bmp, tiff, and ppm. One request can hold 120 images, and the base64 payloads together must be under 10 MB. The API does not download the URL.

{"role": "user", "content": [
  {"type": "text", "text": "What is in this chart?"},
  {"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
]}

The session stores the text and an [image] marker. It does not store the image. Send the image again on a later call when the model should still see it.

Dashboard

The API Platform dashboard shows your API keys, usage, and cost. Sessions list by id with workload and optional run name. Beta accounts share a monthly usage cap across all keys on the account. The call that reaches the cap still completes. The next call returns HTTP 402.

Errors

StatusWhen
401The bearer token is missing or not a known key.
400messages is missing or empty, the model id is unknown, or an image was sent to a model that does not accept one.
402The account's list cost for this calendar month has reached its cap. The body is monthly spend cap reached.
502The model provider failed. The body is detail.

Limits

A different API key with the same session id is a different session. Unrelated tasks on one id share one session, so their outcomes can mix. When several callers use one id, the last completed call is what is stored.

A human approval counts when it comes back in the shape that pack reads. For generic, that is a tool result with a signal: line or a top-level outcome field.