Skip to main content

stimulir

Command-line interface and Python SDK for the Stimulir Console platform — workspaces, API keys, BYOK credentials, usage/billing, prompts, models, inference, realtime voice, and HybrIE lab/compute.

Built with Python 3.11+, Typer, Rich, and httpx. The optional realtime extra adds a websocket voice client (websockets).

Install

Once published to PyPI:

uv tool install stimulir
stimulir --help
# or run without installing:
uvx stimulir --help

From this repo (development):

uv tool install ./cli          # isolated tool from the local source
# or, for live-editing development:
cd cli && uv venv && uv pip install -e .

Conda/miniconda note: if you use plain pip install -e instead of uv, Anaconda Python builds skip the __editable__.*.pth hook, so the editable install silently fails to import (ModuleNotFoundError: stimulir_cli). uv avoids this entirely.

Python SDK

For application or backend code, add the package to that project's runtime environment instead of installing it as an isolated CLI tool:

uv add stimulir                 # core SDK
uv add 'stimulir[realtime]'     # + the realtime voice client (adds websockets)

Then import the SDK from the public package:

import os

from stimulir import StimulirClient

client = StimulirClient(
    api_base=os.getenv("STIMULIR_API_BASE", "https://api.stimulir.com"),
    api_key=os.environ["STIMULIR_API_KEY"],  # hyb_...
)

The hyb_* key is the normal customer/runtime auth path. Stimulir derives the workspace and allowed platform scope from the key, so application code does not need to pass a workspace id for normal prompt, data, eval, or inference calls.

Configuration & auto-resolution

StimulirClient() and the realtime client resolve everything from the environment when you omit it, so most apps construct them with no args. The same resolvers are exposed for direct use:

from stimulir_cli import config Resolves from (in order) Default
config.get_api_base() STIMULIR_API_BASE https://api.stimulir.com
config.get_api_key() STIMULIR_API_KEYHYBRIE_API_KEY → credentials file
config.get_inference_base_url() STIMULIR_INFERENCE_BASE_URLHYBRIE_MANAGED_BASE_URL {api_base}/api/v1/inference
config.get_realtime_url() STIMULIR_REALTIME_URLHYBRIE_REALTIME_URL {api_base}/api/v1/inference/realtime?provider=vertex (https→wss)
config.get_realtime_model() STIMULIR_REALTIME_MODELHYBRIE_REALTIME_MODEL canonical Vertex Live model
config.get_model_preference() STIMULIR_MODEL_PREFERENCEHYBRIE_MODEL_PREFERENCE [] (caller supplies its own list)

Legacy HYBRIE_* names are a deprecated fallback, always below the STIMULIR_* name. Use config.resolve_env(primary, *legacy, default=...) for your own keys.

Prompts

Versioned prompts that render themselves ({{var}} and {var}; None""):

prompt = client.prompts.get("aca.assessment.agent", label="prod")
text = prompt.render({"category": "AI fluency", "name": "Tosin"})
print(prompt.lineage)  # {"prompt_key": ..., "prompt_version": ..., "prompt_label": ...}

Models

models = client.models.list()  # normalized list[str] of advertised model ids

Realtime voice (stimulir[realtime])

The realtime client lives behind the realtime extra — a plain import stimulir never loads websockets. It speaks the managed gateway's voice protocol and enforces the once-only setup invariant: a second setup on a live connection is swallowed, not forwarded (which is what keeps a voice session from fragmenting into one trace per turn).

from stimulir.realtime import RealtimeClient, AudioDelta, ResponseDone

rt = RealtimeClient(  # url / key / model auto-resolve from config if omitted
    instructions="You are a friendly interviewer.",
    temperature=0.7,
)

async with rt.connect() as conn:           # Bearer-only auth
    await conn.setup()                      # once per connection (idempotent)
    await conn.send_audio(pcm16_16k_mono)   # stream input audio
    await conn.commit()
    await conn.create_response()
    async for ev in conn.events():          # typed events
        if isinstance(ev, AudioDelta):
            play(ev.pcm16)                   # 24k mono PCM16 out
        elif isinstance(ev, ResponseDone):
            break

Reconnection policy is the caller's: each connect() is one connection, and the once-only setup guard resets per connection (which is correct — a reconnect needs exactly one fresh setup).

MCP server (stimulir[mcp])

Stimulir as an MCP server — one hyb_* workspace key gives any MCP host (claude.ai, Claude Code, Claude Desktop, Cowork, or your own agent runtime) task-shaped tools: infer (streamed chat), speak (TTS over the realtime lane), transcribe, usage, models, and list_prompts/get_prompt.

Hosted (no install) — point your host at https://mcp.stimulir.com/mcp with an Authorization: Bearer hyb_... header:

claude mcp add --transport http stimulir https://mcp.stimulir.com/mcp \
  --header "Authorization: Bearer hyb_..."

Local (stdio) — the server ships behind the mcp extra:

pip install 'stimulir[mcp]'
stimulir-mcp            # stdio (default)
stimulir-mcp --http     # streamable HTTP on 0.0.0.0:8484

# or without installing:
claude mcp add stimulir -e STIMULIR_API_KEY=hyb_... -- \
  uvx --from 'stimulir[mcp]' stimulir-mcp

Key resolution order: per-request Authorization: Bearer header (hosted) → STIMULIR_API_KEY~/.stimulir/credentials.json (written by stimulir login). Keys are never logged.

Login

stimulir login uses a browser-based device authorization — no password is ever typed in the terminal. It prints a link and a short code, you approve in the console, and the CLI receives a revocable stim_cli_ token:

stimulir login
# 1. CLI prints a link + a short user_code, e.g.
#      Go to https://console.stimulir.com/cli and confirm it shows: ABCD-1234
# 2. Approve in the browser (already signed in) — confirm the code, pick a workspace
# 3. CLI receives an opaque stim_cli_ token, stored in
#    ~/.stimulir/credentials.json (0600), with the workspace pre-selected

Bare stimulir (when logged out) offers to run this same flow inline before starting the agent.

The stim_cli_ token is opaque, revocable, non-refreshable, with a 30-day TTL, pinned to your user and the workspace you selected. To rotate it, just log in again. A 401 from the server means the token expired or was revoked — re-run stimulir login.

The CLI defaults to production. To test against staging, pass --env before the subcommand — it's sugar for exporting STIMULIR_API_BASE for the duration of that one invocation:

stimulir --env staging login
stimulir --env staging keys create --name my-first-key --save
stimulir login   # no flag — back to production

stimulir login pins whichever base you authenticated against into ~/.stimulir/config.json, so a later bare stimulir in a fresh shell stays on staging until you log in again without --env (or stimulir whoami to check which one is active). For a base that isn't a named api.<env>.stimulir.com subdomain (a local dev server, a tunnel), set STIMULIR_API_BASE directly — env var or ~/.stimulir/config.json — instead of --env.

Already have a token from the console web app? Paste it as an escape hatch:

stimulir login --token <token>

Inspect or end your session with:

stimulir whoami           # opaque token: shows local email + prefix, plus
                          # server-confirmed identity, workspace, and expiry
stimulir logout           # clears the local credentials file
stimulir logout --remote  # revokes the server-side token, then clears locally

Authenticating an agent with an API key

Console-plane commands (lab, data, traces, prompts, workspace, ...) accept a hyb_* API key as well as a browser login, so a headless agent that was handed a key can drive them with no interactive step:

export STIMULIR_API_KEY=hyb_...
export STIMULIR_WORKSPACE_ID=<workspace-id>   # required, see below
stimulir lab eval create-run --data-asset-id <asset-id> --execute

Credential precedence, explicit environment before ambient file:

Order Source Notes
1 STIMULIR_ACCESS_TOKEN Console-plane override, forwarded verbatim
2 STIMULIR_API_KEY / HYBRIE_API_KEY Beats any stored login: naming a key for this process is deliberate, a stored login is whatever the machine had
3 cli_token in ~/.stimulir/credentials.json The device login
4 access_token in ~/.stimulir/credentials.json Legacy Supabase session, auto-refreshed
5 api_key in ~/.stimulir/credentials.json Written by stimulir keys create --save; used only when there is no stored login, so it never silently downgrades a logged-in user

stimulir whoami reports which one is in play as auth_kind (access_token / cli_token / api_key).

Two things an API key does not do. It is pinned server-side to the workspace it was minted in, so STIMULIR_WORKSPACE_ID (or stimulir workspace use) must still be set, and must name that workspace — anything else is a 403, not a silent cross-tenant read. And it resolves to the key's creating user without superadmin, so superadmin-only verbs stay closed to it.

Select a workspace

Most commands are scoped to a workspace (business profile):

stimulir workspace list
stimulir workspace use <workspace-id>

Commands

Agent — the AI engineer in your terminal

Bare stimulir (no subcommand, in a TTY) launches the interactive Stimulir agent against the active workspace. The agent runs server-side (Pi through code-runtime) and executes its tool intents — bash, file reads/writes, glob search — on your machine, with approval prompts. The conversation lives server-side, so the same session shows up in the Engineering traces panel.

# Start the agent (or pass an opening task)
stimulir
stimulir agent "Add a /health endpoint and wire it into the router"

# Resume an existing session
stimulir agent --session <session-key>

# Attach this machine as the local executor for a session started in the app
# (the chat composer's "Continue in: Local" dropdown)
stimulir attach [<session-key>]

Approvals stay on your machine — destructive commands (rm -rf, sudo, force push, key revocation) always prompt even under an "always allow" grant.

API keys (hyb_* inference keys)

stimulir keys create --name cli --env prod --expires-in-days 90 --save
stimulir keys list --include-revoked
stimulir keys revoke <key-id>

The plaintext key is shown exactly once; --save stores it in ~/.stimulir/credentials.json so stimulir infer can use it.

BYOK provider credentials

Providers: openai, anthropic, google_gemini, mistral, aws_bedrock, azure_openai, together_ai, nebius.

stimulir byok add --provider anthropic --label "prod key"   # secret prompted without echo
stimulir byok list
stimulir byok verify <credential-id>
stimulir byok remove <credential-id>

Workspace prompts

Versioned prompt management — every save creates a new immutable version, and labels (e.g. prod) move between versions so you can promote or roll back without editing application code.

stimulir prompts list
stimulir prompts get <key> [--label prod|--version N]
stimulir prompts versions <key>
stimulir prompts create --key <key> --file ./prompt.md --label prod --notes "<change notes>"
stimulir prompts update <key> <version> --notes "<change notes>"
stimulir prompts archive <key> <version>
stimulir prompts label <key> <version> <label>

Data assets

Curate datasets for the training loop, including from agent traces:

stimulir data list
stimulir data upload ./dataset.jsonl --stage raw --target sft
stimulir data from-trace <trace-id> --source agent --target sft
stimulir data stage <asset-id> <raw|cleaning|clean_view|snapshot|lab>
stimulir data unstage <asset-id>
stimulir data bulk-stage --ids <asset-id>,<asset-id> --stage lab --target sft
stimulir data update <asset-id> --name "<name>" --target sft
stimulir data snapshot <asset-id>
stimulir data remove <asset-id>

The typical flow is from-tracestage … labsnapshot — turn an agent run into staged data, promote it, then pin a snapshot a training run consumes.

Usage & billing

stimulir usage --window 30d --group-by model
stimulir billing snapshot

Inference

Uses a hyb_* API key (stimulir keys create --save or STIMULIR_API_KEY):

stimulir infer chat "Summarise IFRS 16 in one paragraph" --model hybrie-mid
stimulir infer chat "Write a haiku about ledgers" --model hybrie-small --stream

Codex App

Configure Codex App to use Stimulir as a custom model provider. The default config uses Codex command-backed auth, so Codex asks stimulir codex token for a short-lived Console-minted inference key instead of storing a key in ~/.codex/config.toml.

stimulir launch codex-app \
  --staging \
  --project 1aa6b818-3a8e-450e-b324-b14e16ca7b38 \
  --model zai-org/GLM-5.2

stimulir launch codex-app --dry-run
stimulir launch codex-app --restore
stimulir codex models

HybrIE lab (training + eval)

stimulir lab train sft --family qwen3-4b --lora-rank 8 --examples 500 --epochs 3 --lr 1e-4 --eval-examples 200 --seed 42 --checkpoint-dir runs/sft
stimulir lab train d2l --family qwen3-4b --examples 500 --epochs 3 --lr 1e-4 --eval-examples 200 --seed 42 --checkpoint-dir runs/d2l
stimulir lab train rl --family qwen3-4b --environment niah --prompts 64 --group-size 8 --policy hypernet --lr 1e-5 --kl-beta 0.05
stimulir lab jobs list
stimulir lab jobs get <job-id>
stimulir lab jobs cancel <job-id>
stimulir lab eval runs
stimulir lab eval get <run-id>
stimulir lab eval create-run --data-asset-id <asset-id> --prompt <key>:<version|label> --execute
stimulir lab eval create-run --data-asset-id <asset-id> --prompt <key>:<version|label> --leave-queued
stimulir lab eval execute-run <run-id>
stimulir lab eval tree <run-id>
stimulir lab eval derive <run-id> --rationale "shorter preamble" --prompt-file new-prompt.txt --stop-parent
stimulir lab eval steer <run-id> --body "focus the next branch on the currency-mismatch cases"
stimulir lab eval steers <run-id> --pending
stimulir lab eval ack-steer <run-id> <steer-id> --consumed-by agent-session-abc --note "applied as derive on run X"
stimulir lab eval delete <run-id> [--hard --include-descendants]
stimulir lab eval niah --family qwen3-4b --checkpoint-dir ~/hybrie-mounts/d2l-artifacts/<job>/checkpoint --examples 200 --seed 42
stimulir lab eval adapter --family qwen3-4b --adapter-dir ~/adapters/invoices-lora --examples 200 --seed 42
stimulir lab eval rl --family qwen3-4b --environment niah --policy hypernet --checkpoint-dir runs/rl/<job> --tasks 50 --pass-threshold 0.8
stimulir lab adapters list
stimulir lab adapters get <adapter-id>
stimulir lab adapters load <adapter-id>
stimulir lab adapters unload <adapter-id>

create-run requires exactly one of --execute or --leave-queued; passing neither is an argument error. There is no default because both defaults are wrong. A run created and not started is QUEUED with nothing spawned, and no scheduler anywhere picks queued runs up, so it sits at zero results forever while its status claims otherwise — that is what defaulting to queued does. Defaulting to executing would instead spend real inference money on a command that did not before. --leave-queued is the deliberate version of the first, and it prints the execute-run command that starts the run (start_command in the --json document).

Starting a run detaches. create-run --execute creates the run, starts it and returns immediately with the run id, its status and a console deep link — it does not wait for the eval and there is deliberately no --wait flag, because waiting on a run is exactly the work this surface exists to hand off. Follow a run from the console link, or pull its state on demand with get / tree; a human can redirect it mid-flight with steer, and whichever agent picks the run up next reads that steer off the pending_work block of a status call it already makes.

Set STIMULIR_CONSOLE_BASE (or console_base in ~/.stimulir/config.json) when your API base is not an api.* host, otherwise no link can be derived and the commands say so rather than guessing one.

delete archives by default: nothing is destroyed, the whole branch below the selection is covered, and it is one-way. --hard destroys rows and refuses, with the blocking run ids listed, unless --include-descendants is passed.

Compute (GPU offers + instances + peers)

stimulir compute offers
stimulir compute up <offer-id> --count 2
stimulir compute list
stimulir compute status <instance-id>
stimulir compute down <instance-id>
stimulir compute peers list
stimulir compute peers add --name lambda-a100 --grpc http://10.0.0.5:9090 --realtime http://10.0.0.5:8011
stimulir compute peers remove <peer-id>

Models

stimulir models

HybrIE routing

lab, compute, and models go through the console proxy ({api_base}/api/v1/hybrie/*, Supabase JWT + workspace header) by default. To talk to a HybrIE runtime directly, pass --endpoint http://host:port on any of those commands, or persist it in ~/.stimulir/config.json as hybrie_endpoint — requests then hit {endpoint}/v1/*.

Scripting

Every command accepts --json to emit the raw API response:

stimulir keys list --json | jq '.api_keys[].prefix'

Configuration reference

File Contents
~/.stimulir/config.json api_base, workspace_id, hybrie_endpoint, supabase_url, supabase_anon_key
~/.stimulir/credentials.json (0600) api_key, cli_token (opaque stim_cli_ from device login), optional access_token, refresh_token, expires_at, email

Common environment overrides: STIMULIR_API_BASE, STIMULIR_API_KEY, STIMULIR_WORKSPACE_ID, SUPABASE_URL, SUPABASE_ANON_KEY. Use stimulir workspace use <id> to persist the active CLI workspace. See Authenticating an agent with an API key for the order these credentials resolve in.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stimulir-0.1.286.tar.gz (238.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stimulir-0.1.286-py3-none-any.whl (187.2 kB view details)

Uploaded Python 3

File details

Details for the file stimulir-0.1.286.tar.gz.

File metadata

  • Download URL: stimulir-0.1.286.tar.gz
  • Upload date:
  • Size: 238.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for stimulir-0.1.286.tar.gz
Algorithm Hash digest
SHA256 bcc1a5124c3fcefcea3a5564470974c07796ebe9891ee8cd64b22cd989af3144
MD5 cba922481748181a3e4ac29561780219
BLAKE2b-256 31afd571574ac2545abbe655c8db99e554903a682f4678484a11279f8ea7a300

See more details on using hashes here.

Provenance

The following attestation bundles were made for stimulir-0.1.286.tar.gz:

Publisher: release-all.yml on stimulir/stimulir-console

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stimulir-0.1.286-py3-none-any.whl.

File metadata

  • Download URL: stimulir-0.1.286-py3-none-any.whl
  • Upload date:
  • Size: 187.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for stimulir-0.1.286-py3-none-any.whl
Algorithm Hash digest
SHA256 839889068df947eddad52e4ad6bcdcdcc172871c0548bc6d345d787c6afd3a07
MD5 a9cbf12f55b8e2d0b173a65724f37015
BLAKE2b-256 db31906d6c0b8799451f288e16c915251930ec1f9ab408250acc362a125c1c63

See more details on using hashes here.

Provenance

The following attestation bundles were made for stimulir-0.1.286-py3-none-any.whl:

Publisher: release-all.yml on stimulir/stimulir-console

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.1

2 files

0.2.0

2 files

This release

0.1.286 This release

2 files

0.1.285

2 files

0.1.284

2 files

0.1.283

2 files

0.1.282

2 files

0.1.281

2 files

0.1.280

2 files

0.1.279

2 files

0.1.278

2 files

0.1.277

2 files

0.1.276

2 files

0.1.275

2 files

0.1.274

2 files

0.1.273

2 files

0.1.272

2 files

0.1.271

2 files

0.1.270

2 files

0.1.269

2 files

0.1.268

2 files

0.1.267

2 files

0.1.266

2 files

0.1.265

2 files

0.1.264

2 files

0.1.263

2 files

0.1.262

2 files

0.1.261

2 files

0.1.260

2 files

0.1.259

2 files

0.1.258

2 files

0.1.257

2 files

0.1.256

2 files

0.1.255

2 files

0.1.254

2 files

0.1.253

2 files

0.1.252

2 files

0.1.251

2 files

0.1.250

2 files

0.1.249

2 files

0.1.248

2 files

0.1.247

2 files

0.1.246

2 files

0.1.245

2 files

0.1.244

2 files

0.1.243

2 files

0.1.242

2 files

0.1.241

2 files

0.1.240

2 files

0.1.239

2 files

0.1.238

2 files

0.1.237

2 files

0.1.236

2 files

0.1.235

2 files

0.1.234

2 files

0.1.233

2 files

0.1.232

2 files

0.1.231

2 files

0.1.230

2 files

0.1.229

2 files

0.1.228

2 files

0.1.227

2 files

0.1.226

2 files

0.1.225

2 files

0.1.224

2 files

0.1.223

2 files

0.1.222

2 files

0.1.221

2 files

0.1.220

2 files

0.1.219

2 files

0.1.218

2 files

0.1.217

2 files

0.1.216

2 files

0.1.215

2 files

0.1.214

2 files

0.1.213

2 files

0.1.212

2 files

0.1.211

2 files

0.1.210

2 files

0.1.209

2 files

0.1.208

2 files

0.1.207

2 files

0.1.206

2 files

0.1.205

2 files

0.1.204

2 files

0.1.203

2 files

0.1.202

2 files

0.1.201

2 files

0.1.200

2 files

0.1.199

2 files

0.1.198

2 files

0.1.197

2 files

0.1.196

2 files

0.1.195

2 files

0.1.194

2 files

0.1.193

2 files

0.1.192

2 files

0.1.191

2 files

0.1.190

2 files

0.1.189

2 files

0.1.188

2 files

0.1.187

2 files

0.1.186

2 files

0.1.185

2 files

0.1.184

2 files

0.1.183

2 files

0.1.182

2 files

0.1.181

2 files

0.1.180

2 files

0.1.179

2 files

0.1.178

2 files

0.1.177

2 files

0.1.176

2 files

0.1.175

2 files

0.1.174

2 files

0.1.173

2 files

0.1.172

2 files

0.1.171

2 files

0.1.170

2 files

0.1.169

2 files

0.1.168

2 files

0.1.167

2 files

0.1.166

2 files

0.1.165

2 files

0.1.164

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page