Skip to main content
The theo.keys namespace creates API keys and shapes their per-key orchestration programmatically: the model plan, the orchestrator graph, the skill allowlist, the routing preference, and the guardrail policy. It’s the SDK surface behind the dashboard’s Orchestrator and behind the MCP configuration tools.
Every method here requires the calling key to hold the billing scope (key creation and per-key configuration are account-management operations). Whatever you configure applies to that key on both the native /v1/completions and the OpenAI-compatible /v1/chat/completions endpoints.
Engine ids used below are the real upstream ids (this is a configuration surface): arca-velox-5.1 (fast), arca-magnus-5.1 (deep reasoning), anthropic/claude-sonnet-4.6, anthropic/claude-opus-4.8, anthropic/claude-haiku-4.5, google/gemini-2.5-pro, openai/gpt-4.1, plus your own custom:<providerId>:<model>.

keys.create

Create a new API key. The raw secret is returned once — store it immediately.
Returns CreatedApiKey ({ id, key, name, scopes, … }).

keys.getModelPlan / keys.setModelPlan

The model plan is the simplest way to control which engine a key runs. single_model pins one engine for every text turn — a deterministic passthrough that skips the classifier (ideal for coding / IDE backends, including a custom: BYO model). bindings instead remap individual modes.
Each binding accepts an optional fallback_upstream_id used if the primary engine is unavailable.

keys.getOrchestratorGraph / keys.setOrchestratorGraph

For full control, set a runnable orchestrator graph — Entry → Classifier / Router → Model → Guardrail. An enabled graph must have an entry node and at least one model node with an engine.
Guardrail nodes (type: "guardrail", config.guardrailPolicyId) placed before the model screen the prompt (input); placed after it, they screen the reply (output). Router nodes apply the key’s bound routing preference.

keys.getSkills / keys.setSkills

Set the key’s skill allowlist. Each binding grants one skill; an optional mode scopes it to a single mode (omit / null = all modes).
An empty allowlist means inherit-all (the key can call any skill the owner has installed).

Routing & guardrails

Two more binders live on keys and are documented alongside their feature pages:
  • keys.getRoutingPreference / keys.setRoutingPreference — bind a Routing Studio preference (keyword/regex → mode). See Routing Studio.
  • keys.getGuardrailPolicy / keys.setGuardrailPolicy — bind a Gateway Guardrails policy. See Guardrails.

Bring your own models

Register your own OpenAI-compatible endpoint, then reference it by its custom:<providerId>:<model> id in setModelPlan (single_model) or on a graph Model node. You can declare each model’s context window so oversize requests are caught before they reach your endpoint. See the changelog and the custom providers REST endpoint. Prompts to your own models are free and never draw credits.

Billing helpers

Top up credits or open the billing portal from code (top-level, not under keys):
scope: "org" funds / manages the team credit pool.