Skip to content

Models

Last updated November 8, 2026

On this page

Agents plan with a language model. OrchKernel does not ship one: you connect your own provider, in the workspace (Models in the sidebar, or step 2 of the first-run wizard), with a key in the environment, or in a file called llm.yaml. For each model you set the most sensitive data it may see and what it costs. OrchKernel sends a call only to a model allowed to see the data in it, and charges the call to the run's budgets.

This page covers connecting a model, checking it with ok doctor, what goes wrong and how it looks, how calls are routed by data class, conversation history, and cost. What is not possible yet is listed at the end.

Where OrchKernel looks for models#

Models come from two places, and a server uses both:

  • The server's configuration, set by whoever runs the server and read at start: the first of these that exists.

    Order Source Notes
    1 The file OK_LLM_CONFIG names A path relative to the folder you start from, or absolute. If the file does not exist, OrchKernel stops with "No such file or directory" instead of moving on.
    2 llm.yaml in the folder you start from For the demo, that is the folder you run ok demo serve in, not the demo's own folder (orchkernel-demo).
    3 Provider keys in the environment ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY (or GOOGLE_API_KEY), OLLAMA_HOST.

    When a file is found, the environment keys are not picked up on their own; the file names each provider's key itself (api_key_env). A variable that is set but empty counts as not set. To change this part, edit it and restart the server.

  • The workspace: providers an admin connects on the Models page (below). They take effect at once, with no restart.

Connect a model in the workspace#

Admins open Models in the sidebar (under Company), or step 2 of the first-run wizard. Both show the same form:

  1. Pick a provider: Anthropic, OpenAI, Gemini, Ollama (a model on your own machine or network) or OpenAI-compatible (vLLM, Groq, Mistral, Together, OpenRouter, LM Studio, or anything else that speaks the OpenAI API). An OpenAI-compatible server gets a name you choose (lower-case letters, digits and -, up to 32 characters).

  2. Enter the key (and for Ollama or an OpenAI-compatible server, its address). The key is a password field: it is sent once, stored encrypted with the server's secrets key (OK_SECRETS_KEY, or the tenant's key), and never shown again, logged or put in an event.

  3. Test. The server asks the provider which models it offers; no tokens are spent. A wrong key, an address that does not answer, or a server with no models says so here in one plain sentence, such as "Nothing answered at http://localhost:11434. Is Ollama running on that machine?" or "Anthropic did not accept this key. Copy it again from console.anthropic.com."; Details below it shows the error as the server saw it. Nothing is saved.

  4. Choose the models: the provider's current models are ticked at list prices, with the default marked. Untick any you do not want, pick the default, and set how sensitive the data each may see is:

    Clearance What it covers
    Public Only what is public anyway: published pages, product documentation.
    Internal Everyday company work: tasks, notes, internal threads.
    Confidential Customer and deal data: CRM records, support tickets, contracts.
    Restricted The most sensitive data: pay, health, credentials, legal matters. For a model on your own machine, or a vendor whose agreement covers it.

    The hosted presets keep the clearances of One key: Anthropic's models restricted (Haiku confidential), OpenAI's and Gemini's confidential, Ollama's restricted. When a hosted model is set to restricted, the form says "Lower this unless your agreement with the vendor covers restricted data."

  5. Connect. The next ask uses it.

The rules behind the form:

  • Addresses must be https, or http to this machine or a private network (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7). Link-local addresses (169.254.0.0/16, fe80::/10, where cloud metadata lives) and the unspecified address are refused. The address is checked on what the name resolves to at save and at every test, and every connection is made only to addresses that pass the same check, so a name that later resolves somewhere else cannot reach a refused address. Anthropic's, OpenAI's and Gemini's addresses are fixed here; a proxy goes in llm.yaml.
  • Under ok serve --tenants, a tenant's providers may use only https to addresses on the internet: nothing on the server's own machine or its private network. The operator can name hosts every tenant may reach there, such as one shared Ollama, in OK_TENANT_MODEL_HOSTS (comma-separated host names or addresses, as written in the base URL). Tenants' providers ignore HTTPS_PROXY and connect directly; a single-tenant server's remote providers use it as the operator's do.
  • A provider connected here is never followed through a redirect: an answer of 3xx fails the test or the call ("answered with a redirect, which is not followed"); give the address it redirects to. Its answers are never copied into messages: a failed test or run shows the status and the vendor's own error type and message, never the body.
  • A key needs the server's secrets key. Without one, saving answers "Set OK_SECRETS_KEY ... and restart before storing a model key" (503 secrets_key_missing). Changing a provider's address forgets its key.
  • Saving a key, or testing with one, needs a recent sign-in in the workspace (within ten minutes); an API token never carries a key. An admin may test ten times a minute, and saving with its check counts as a test (429 after that).
  • Every change is recorded in the event log (model_provider_changed with the fields that changed and whether the key was set, kept or cleared; model_provider_removed; default_model_changed; local_search_changed), never with the key.
  • ok secrets rotate re-encrypts these keys with the others.

How the two places combine. The server's configuration comes first:

Part Rule
Providers The configuration's providers, plus the workspace's. A workspace provider with the name of a configured one is not used, and shows "Replaced by the server's configuration (llm.yaml)".
Model ids An id a configured provider serves is not taken from a workspace provider.
Keys A configured provider without its key is left out, as always. A workspace provider whose key does not open with the secrets key is left out and shows "Key does not open".
Default model The workspace's default when a connected model serves it; else the configuration's default; else the first model.
Search by meaning The configuration's embedding models (in llm.yaml, or OK_EMBED_LOCAL) win and the switch is read-only; otherwise the workspace's switch decides.
Under tenancy The process's configuration applies to every tenant; workspace settings and keys are each tenant's own, sealed with its key.

The Models page also lists every provider with where it came from, its key, its last check (with Test to check again) and its models, lets you pick the default model, and turns the built-in model for search by meaning on or off.

Raising a model's clearance#

When an agent cannot answer because no model is cleared for its data, the person who asked can press Ask an admin, and the admin's inbox item "... needs a model for customers' personal details so Sales Assistant can answer · Fix this" opens Models at Clearance, with the clearance needed highlighted (see When no model may take the data).

  1. Under Clearance, choose Raise to on a model connected in the workspace. Models from the server's configuration are not offered: change max_sensitivity in llm.yaml instead.
  2. Raising a hosted vendor's model (Anthropic, OpenAI, Gemini) to Restricted asks you to tick "Our agreement with this vendor covers restricted data." A model on your own machine is safest for that data.
  3. Choose Raise it. The person who asked sees " can now answer" with Try again. The change is recorded as model_clearance_changed.

Whether agents can run#

Every signed-in person can ask whether agents can run (GET /api/models/status). When they cannot, a banner sits above every page of the workspace; admins get Connect a model beside it.

State When What admins read What everyone else reads
ready The default model is connected and its last check did not fail (no banner) (no banner)
stub The demo's built-in planner answers "This demo answers with a built-in planner. Connect a model for real answers." (on the Models page) (nothing)
none No model is connected "Agents cannot run until a model is connected." "Agents cannot run yet: an admin needs to connect a model."
locked No model, and a key stored in the workspace does not open with this server's secrets key "The model key cannot be opened with this server's secrets key. Enter it again." as none
rejected The default model's provider refused its key "Anthropic rejected its key. Agents cannot run until an admin enters one that works." "Agents cannot run right now: an admin needs to fix the model connection."
unreachable The default model's provider did not answer its last check "Anthropic could not be reached at 09:41. Agents may fail until it answers." "Agents may not answer right now."

While the state is none or locked, asking an agent (a message in the box, an @mention, Run now, Ask again, ok ask) is refused at once with the sentence above (409 no_model), and no task or run is made. An explicit plan needs no model and still runs. A run that meets a refused key fails with "the model provider rejected its key (...)", and the state turns to rejected until a call or a test succeeds again. While it is, that provider's models are out of routing: the next calls go to another model cleared for the data, when one is connected, and only when none is do they still go to the refused one (and fail saying so). A new key, a passing Test or a restart's check brings them back.

One key: the quickest start#

Set one variable and OrchKernel offers that provider's current models at list prices. Prices are in US dollars per million tokens, input / output.

Variable Models offered May see up to Price
ANTHROPIC_API_KEY claude-sonnet-5 (default) Restricted $2 / $10
claude-opus-5-5 Restricted $4 / $20
claude-fable-5-1 Restricted $10 / $50
claude-haiku-4-5-20251001 Confidential $1 / $5
OPENAI_API_KEY gpt-5 Confidential $1.25 / $10
gpt-5-mini Confidential $0.25 / $2
GEMINI_API_KEY or GOOGLE_API_KEY gemini-2.5-pro Confidential $1.25 / $10
gemini-2.5-flash Confidential $0.30 / $2.50
OLLAMA_HOST (for example http://localhost:11434) OLLAMA_MODEL, or llama3.1 Restricted Free

The default model is claude-sonnet-5 when the Anthropic key is set. Otherwise it is the first model of the first provider found, in the order of the table: gpt-5 with only an OpenAI key, gemini-2.5-pro with only a Gemini key. ANTHROPIC_BASE_URL and OPENAI_BASE_URL point those providers at another address, such as a proxy.

"May see up to" is the model's sensitivity cap, explained in Which model may see which data. In short: with only an OpenAI or Gemini key, no model may see restricted data such as the demo's customer tickets, and asks that read them are refused. In the demo that includes the Support Agent, the Churn-risk watcher and the Product Agent, whose skills all read tickets.

Switching the demo to a real model#

The demo starts with a stub planner when no model is configured: fixed plans for the walkthrough's asks and a note for anything else (see Asking an agent). Before you switch, the start banner reads Model none configured: a stub planner answers the walkthrough's asks.

The quickest way needs no restart: pick Ada Park under Demo people, open Models in the sidebar and connect a provider with its key, as in Connect a model in the workspace. The next ask uses it. The steps below use the server's configuration instead.

  1. Stop the demo with Ctrl+C.
  2. Set a key in the same terminal, for example export ANTHROPIC_API_KEY=sk-ant-..., or put an llm.yaml in the folder you start from (see Writing llm.yaml).
  3. Check it: run ok doctor in the same folder. You should see a line starting ok for each provider and then default model: claude-sonnet-5 (or your file's default). See Checking with ok doctor.
  4. Start the demo again with ok demo serve. Before the banner, the terminal prints one line per provider from a key check, such as llm: house: reachable, or a warning: line if a key is missing or refused. In the banner, the Model line names the default model and where it came from, for example Model claude-sonnet-5, configured from the environment (ANTHROPIC_API_KEY, OPENAI_API_KEY, ...) or Model house-model, configured from llm.yaml.
  5. As Ada (pick Ada Park under Demo people if you are signed out; the printed API tokens change on every start), open Governance, tab Policy. The Model governance card shows default: claude-sonnet-5 · configured providers serve 4 model(s) (your default and count) and a table with each Model and May see up to. With the stub it shows default: mock-default · configured providers serve 0 model(s) and two rows, mock-default and the search model all-MiniLM-L6-v2, both Restricted.
  6. As pat (product manager), open Threads, click Product Agent under Talk to an agent and ask What should we build next quarter?. With the stub you get the note "No model is configured, so the demo's stub planner answered. ..." With a model allowed to see restricted data you get the model's answer and a green Done badge. Open Details on the run card: the Model step shows the tokens and the cost (see Cost). With a model capped at confidential the run fails instead, with "policy denied llm.complete: no allowed model for data class pii.customer".

Writing llm.yaml#

Copy llm.example.yaml from the repository to llm.yaml and keep the providers you want. A provider whose key is not set is skipped at start with a warning, so the copied file works with only one key set.

yaml
providers:
  - name: anthropic
    kind: anthropic
    api_key_env: ANTHROPIC_API_KEY
    models:
      - { id: claude-sonnet-5, max_sensitivity: restricted, input_per_mtok_cents: 200, output_per_mtok_cents: 1000, default: true }
      - { id: claude-haiku-4-5-20251001, max_sensitivity: confidential, input_per_mtok_cents: 100, output_per_mtok_cents: 500 }

Provider settings:

Field What it does
name Your name for the provider. It appears in messages ("house rejected the API key").
kind anthropic, openai, gemini, azure_openai or openai_compatible.
api_key_env The environment variable holding the key. Keeps the key out of the file.
api_key The key itself. Prefer api_key_env.
base_url The server's address. Needed for azure_openai and for most openai_compatible servers.
api_version Azure only, for example "2024-10-21".
models The models below.

Model settings:

Field What it does If left out
id The model id the provider knows. For Azure, the deployment name. Required
max_sensitivity The most sensitive data this model may see: public, internal, confidential or restricted. internal
input_per_mtok_cents, output_per_mtok_cents Price in cents per million tokens. 200 means $2.00. 0: calls cost nothing
default: true The company's default model. The first model in the file
vision Whether the model reads images people attach (true or false). On for Claude, GPT-5, GPT-4o, GPT-4.1 and Gemini models and for LLaVA, Llama 3.2 Vision, Qwen 2.5 VL and Gemma 3; off for the rest

Set max_sensitivity on purpose. Left out, a model may see internal data only, and every ask that reads customer data is refused.

OpenAI-compatible and local servers#

kind: openai_compatible covers any server that speaks the OpenAI chat completions API: Ollama, vLLM, LM Studio, Groq, Mistral, DeepSeek, Together, OpenRouter. It needs no key unless the server asks for one.

yaml
  - name: ollama
    kind: openai_compatible
    base_url: http://localhost:11434/v1
    models:
      - { id: llama3.1, max_sensitivity: restricted }

A model on your own machine or network is the usual place for restricted data: nothing leaves it, so you may mark it restricted. Keep hosted models at confidential or below unless your contract with the vendor says otherwise. Leave out the prices for a local model and its calls cost nothing.

Anthropic, OpenAI and Azure answer plans through native tool calling. OpenAI-compatible servers and Gemini are asked for JSON and their text is read as a plan. Every plan is checked before a single step runs, whichever way it arrived.

Checking with ok doctor#

ok doctor checks each provider without spending tokens: it asks the provider for its list of models. Run it in the folder you start the server from, so it reads the same llm.yaml.

sh
ok doctor

Under Models it prints where the server's configuration came from ("LLM configuration from llm.yaml"), one line per configured provider ending with its models in brackets, then each provider connected in the workspace, read from a snapshot of the state while the server runs too: its kind, its key (set, locked, none or not needed), its models and the result of a check. Then default model: ... and whether agents can run. Nothing is downloaded for search by meaning. It exits with 1 when any line is an error, such as a configured key that is refused or no model at all; a workspace provider that fails its check is a warning. The same command also checks the secrets key, file permissions, the state lock and backups; those lines are explained in ok doctor.

You see Meaning What to do
ok anthropic: reachable, key accepted [claude-fable-5-1, ...] Ready. Nothing.
ok house: reachable [house-model] Ready. A server that needs no key says only "reachable". Nothing.
ok house: reachable; not offered to this key: house-smal (check the model ids) [house-model, house-smal] The provider answers but does not list that model, usually a typo. Calls to it will fail, although the line says ok. Fix the id.
error provider anthropic has no API key: ANTHROPIC_API_KEY is not set (export it, or set api_key in llm.yaml) The file names a key that is not set. The server skips this provider. Export the key, or remove the provider.
error anthropic rejected the API key (HTTP 401: authentication_error: ...); check ANTHROPIC_API_KEY The key is wrong, revoked or for another account. With api_key in the file it ends "check api_key in llm.yaml". Replace the key.
error local: cannot reach http://127.0.0.1:8896/v1: ... Connection refused (os error 61) The server is not running or the address is wrong. Start it or fix base_url.
error Agents cannot run until a model is connected: an admin connects one in the workspace (Models in the sidebar), or set a provider key ... No model from the configuration or the workspace. Connect one in the workspace, or set a key or write llm.yaml.
warning local-ai (openai_compatible), connected in the workspace, key locked [m1]: ... A key stored in the workspace does not open with this secrets key. Enter it again on the Models page.

When a key is missing or rejected#

Errors name the provider and never contain your full key.

Situation ok serve / ok demo serve A run that needs a model
No provider at all ok serve notes "no model is connected, so agents cannot run yet. An admin connects one in the workspace (Models in the sidebar), or set a provider key ... or llm.yaml". The one-shot commands (ok ask and others that may call a model) say the same as a warning, once the workspace's own models are counted. ok demo serve uses the stub planner instead. An ask is refused at once with "Agents cannot run until a model is connected." (409 no_model). A run a trigger starts fails with "llm: no model provider is configured: ..." (outside the demo).
A provider in llm.yaml without its key Warns at start: "warning: provider anthropic has no API key: ANTHROPIC_API_KEY is not set (...); its models are off". The others work. Goes to the providers that are left.
A key that is set but refused Starts normally and warns: "warning: house rejected the API key (HTTP 401: ...); check api_key in llm.yaml". Its models stay listed and the banner says the key was rejected, but calls go to another model that may see the data while one is connected. Goes to another model cleared for the data. With none, fails with "llm: the model provider rejected its key (house rejected the API key (HTTP 401: ...); ...)".

The server checks every key once at start. Set OK_LLM_CHECK=0 to skip that check. The one-shot commands (ok ask, ok approve, ok answer, ok tick) do not check keys at start; they report a refused key on the first model call, for example run ... failed: llm: house rejected the API key (...). ok ask still exits with 0 when the run fails, so check its output in scripts.

A refused key, a rate limit that outlasts the retries, or a timeout fails the run. It shows as Failed with the message in the conversation's run card and on the Work page.

Retries and timeouts#

Each model call is retried when retrying can help.

Setting Default Change with
Attempts per call, the first included 4 OK_LLM_MAX_ATTEMPTS (at most 10)
Time one attempt may take 180 s OK_LLM_ATTEMPT_TIMEOUT_SECS
Time the whole call may take, retries included 300 s OK_LLM_DEADLINE_SECS
Longest retry-after honored 60 s
  • Retried: answers 429 (rate limit), 408, 409 and any 5xx (Anthropic's 529 overloaded among them), dropped connections and timeouts. The wait doubles from half a second up to 8 seconds, with some randomness, unless the provider says how long to wait.
  • Not retried: 401 and 403 (a refused key) and other 4xx answers.
  • When retries run out, the run fails with what happened, for example "llm: provider error: house HTTP 429: rate_limit: slow down (4 attempts)". A call that runs past its deadline says "no answer within the 300s deadline".

Which model may see which data#

Every collection has a data class: a label for how sensitive its data is, shown on the Brain page next to each collection, for example "Kept here · Customer PII" (see The brain). Each class has a sensitivity, from least to most sensitive:

Sensitivity Examples in the demo (Brain label, then the class label)
Public None in the demo (public)
Internal Internal (internal): Campaigns, Feature requests and most company records
Confidential Financial (financial): Forecasts; Confidential (confidential): Incidents, Investor updates
Restricted Customer PII (pii.customer): Tickets, Contacts; Candidate PII (pii.candidate): Candidates; Captured content (captured): Context items

A model call carries the most sensitive class of everything in it: the skill's collections, what the run has read, and any conversation history. The call goes to a model only if that model's max_sensitivity covers it.

How the model is chosen:

  1. The company's default model, if it may see this class.
  2. Otherwise the first model, in the order of your configuration, that may.
  3. If none may, the call is refused. It is never sent to a weaker model.

The run then fails, and its card says so in words, with what to do: "Support Agent could not answer: it was working with customers' personal details, and none of the AI models your company has set up is cleared for that kind of data.", with Fix this for admins and Ask an admin for everyone else (see When no model may take the data). The gate's own line, "policy denied llm.complete: no allowed model for data class pii.customer", stays under the run's Details. In the demo, with only models that stop at confidential, these fail that way:

  • maya asking the Churn-risk watcher Northwind wants a refund for the double charge;
  • maya asking the Support Agent Summarize the open tickets;
  • pat asking the Product Agent What should we build next quarter?.

None of these costs anything. Give a model max_sensitivity: restricted (Anthropic's from the environment, or a local model) and they reach it. With a confidential default and a second, restricted model, these asks go to the second model; the Model step's hover text names it.

To see the routing without running anything, as ada:

  1. Open Governance, tab Policy, card Try an action.
  2. Choose Who: Churn-risk watcher (agent), Acting for: Maya Patel, Action: Call a model, and type pii.customer under Data class.
  3. Choose Explain. With a model that may see restricted data you see Allowed, and the first Model line reads "The call goes to model claude-sonnet-5" (your model's name). Without one you see "Denied: no allowed model for data class pii.customer"; the later steps are marked "(after the decision)". Nothing is executed or recorded.

Type the class label, not the name the Brain page shows: pii.customer for Customer PII. The label is read as a run reads it: public and internal as themselves, confidential and financial as confidential, and restricted, every pii. label and any other label (captured, an app's own) as restricted, so the answer never says a model may receive data a run would not give it.

The Model governance card on the same tab lists each model and what it may see, the search-by-meaning model included. It is read-only: it follows the server's configuration and the models connected on Models.

The model you see on an answer and in the message box#

An agent's answer names the model its run used: the model of the run's last model call. The message box names the model the agent you are asking would use: its preferred model when governance allows it for internal data, else the company's default, else the first allowed model, never one the agent or governance rules out. A call that carries more sensitive data can still go to another allowed model, as above, and the answer then names that one. You cannot pick a model for an ask.

Conversation history#

When you ask an agent again in the same conversation or thread, the model sees the earlier exchange as turns: your earlier asks and the agent's earlier answers ("Done: What should we build next quarter?" and its output), up to the 20 most recent, oldest first. In a thread it also sees, fenced as data, other agents' answers (the latest 6, at most 2,000 characters each) and other people's messages that name it or answer one of its questions. In a loop run the model also sees its earlier rounds and their results.

  • Size. A thread's history is at most 24,000 characters, and a call's history is kept within 60,000 estimated tokens (OK_LLM_HISTORY_TOKENS changes the second). When it is longer, other agents' answers are left out first, then the oldest turns; the first message says how many were left out. Estimates go by size, so compact data counts in full.
  • Data class. History counts toward the call's data class. Each of the agent's answers carries the class of what its run had read, and at least that of the collections its skills reach; an answer with no recorded class counts as restricted. If no allowed model may take the agent's earlier answers, they are left out and only your own messages go.
  • Where it applies. Only what the person the agent works for may see is read. Other people's messages that do not name the agent are not sent. What several agents see of each other is in Asking several agents together.
  • Starting fresh. New conversation at the top of the conversation starts an empty history.

Cost#

Each model call is charged at the price you configured, from the token counts the provider reports, rounded up to the next cent. A call to a priced model that used tokens is never recorded as free.

When a provider reports no token counts, OrchKernel estimates them from the size of the request and the answer (about four characters a token) and marks the Model step estimated.

Where you see it:

Where What it shows
A run card in a conversation, Details "5 steps · $0.05 · Open the run", then each step. The Model step reads "Planned the next step · 12,400 tokens" with its cost on the right; hover it for the model and the tokens in and out ("model house-small: 12,000 in, 400 out").
Work, tab Runs One row per run with Steps, Cost and Tokens.
Work, a run opened from that tab "Product Agent acting for Pat Kim · $0.05 · 12,400 tokens", then the trace and the output.
Directory, an agent's page, tab Scorecard Runs, Succeeded, Success rate, Cost and Tokens for the last 7 and 30 days.

For example, a call to a model priced at $3 / $15 per million tokens that reads 12,000 tokens and writes 400 costs 4.2 cents, recorded as $0.05.

Every call is also charged to the budgets in scope: the agent's token budget and money budget, the task's budget, and for a loop run its max_cost and max_tokens caps (see Agents). An agent past its token budget is refused before the call is made: "token budget exhausted (N used of M)". The stub planner costs nothing.

Models that read images#

When someone attaches a screenshot or a photo and asks an agent about it, the image goes to a model that reads images (its vision setting, else its family, as in the table above), and only when that model may see the thread's data. A call with images routes like any other call, among the models that read them: the default when it does and is cleared, otherwise the first that is. When no such model may take the data, the agent answers from the files' text alone and says "Images were not sent: no model that reads images is cleared for restricted data." An admin can turn image reading off for the company, and the operator for the server with OK_FILES_READ_IMAGES=off; the agent then says "Images are not read in this workspace." At most four images go in one call, each the preview the server made (re-encoded, with no location or other metadata), never the original file.

Speech providers#

A speech provider turns call recordings into text for Call notes. Speech providers sit beside models, under Models → Speech (admins), with the same key handling. No company has one until an admin adds it, and nothing is sent to a provider before then.

Add a speech provider asks:

Field What it means
Provider Sarvam, Deepgram, or an OpenAI-compatible server (a hosted one, or your own on your network)
Short name, Address, Key The key is sent once, sealed with the server's secrets key (a tenant's own key under tenancy), and never shown again. A key never follows a changed address: enter it again
What it charges a minute From your contract. The meter counts at this rate, in micro-units (a cent is 10,000), rounding up
Monthly limit Required. Reaching it pauses speech, and calls keep arriving; they wait, newest first, with the reason on the source's row. $0 stops every call, and the page says so
Cleared for restricted data "Our agreement with this vendor covers restricted data." Call recordings are restricted, so a hosted vendor needs this tick, which means a data processing agreement is in place. Leave it off for a server on your own network, which needs none
No training Its terms say it does not train on your calls. Unset, restricted audio is refused. The vendor's own no-training option is also sent on every request
Days the vendor keeps audio By its terms. 0 means it deletes at once: it is asked to when the call's job ends. Left empty, a hosted vendor gets no recordings
Allow it outside your regions for A country, typed by an admin, when your regions would refuse this provider. Leave it empty unless a region stops it
Speaker labels Ask it to tell speakers apart, but not for numbers in the countries you list. Labels are kept only with the call; no voice profile is kept here, and the vendor's terms say what it keeps
Languages Which languages this provider is used for

Test sends one second of silence, counted on the meter, never a call.

Where words may go. Audio regions list where recordings may be sent; a provider outside them is refused with "This provider is outside the regions your company allows". A region is not simply what was typed: a named vendor's comes from its kind and its address, and local holds only for a server on a private address, or, under tenancy, a host the operator named in OK_TENANT_MODEL_HOSTS. An internet address claiming to be local needs the country tick like any hosted vendor. Left empty, the regions start from your country: in and local for a company in India, eu and local on the European Union preset, any for the rest. Transcript regions apply the same list to the models and search embedders that read a call's words: the model writing notes reads the text, so keeping voice in one country does not keep the words there. Setting transcript regions stops notes until a model and an embedder in them are cleared.

Each refusal has its own sentence: "This provider is not cleared for restricted data", "Vendor retention and training are not set for this provider", the region's above, and "{provider} reached this month's limit of {amount}". The shortest and longest call to transcribe (30 seconds and 180 minutes by default) are set here too. How long audio is kept, and how much room it may take, are set once, in Settings → Call notes; this page shows them with a link there.

The speech.transcribe kill switch (Policy) stops every speech job; capture goes on.

In llm.yaml. The operator may list speech providers under speech:; those win over a workspace's provider of the same name and cannot be changed on the page:

yaml
speech:
  - id: acme-speech
    kind: deepgram                   # sarvam, deepgram, openai_compatible
    base_url: https://api.deepgram.com
    max_sensitivity: restricted      # cleared for restricted data
    micro_per_minute: 5200           # $0.0052 a minute
    monthly_cap: 50000000            # $50; required
    no_training: true
    retention_days: 0
    api_key_env: SPEECH_KEY          # or api_key
    region_tick: United States       # only when your regions would refuse it

Under tenancy each tenant has its own speech providers, keys (sealed with the tenant's key), meter and room for audio. One tenant's provider, spend or limit is never another's.

Not possible yet#

  • Choosing a model per agent or per skill. Every call goes to the default model when it may see the data, otherwise to the first model that may.
  • Changing the models of the server's configuration from the screen. Edit llm.yaml (or the environment) and restart; the workspace's own providers change at once.
  • Changing the address of Anthropic, OpenAI or Gemini in the workspace (a proxy goes in llm.yaml), or connecting Azure OpenAI there.

For developers#

Environment#

Variable Default Purpose
OK_LLM_CONFIG ./llm.yaml The model configuration file.
ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, GOOGLE_API_KEY Keys; used when there is no file.
ANTHROPIC_BASE_URL, OPENAI_BASE_URL The vendor's API Another address for a provider found from the environment.
OLLAMA_HOST, OLLAMA_MODEL llama3.1 A local Ollama server, used when there is no file.
OK_LLM_CHECK on 0 skips the key check at server start.
OK_LLM_MAX_ATTEMPTS 4 Attempts per call, at most 10.
OK_LLM_ATTEMPT_TIMEOUT_SECS 180 One attempt.
OK_LLM_DEADLINE_SECS 300 The whole call.
OK_LLM_HISTORY_TOKENS 60000 Conversation history per call, in estimated tokens.

Calls to remote providers honor HTTPS_PROXY and the other proxy variables; calls to localhost and 127.0.0.1 bypass the proxy.

API#

The workspace's models. "Admin" is a human admin, signed in to the workspace or with an API token; a request that carries a key needs a workspace session with a recent sign-in (a token cannot).

Method and path Who Returns
GET /api/models/status Anyone signed in { state, message, default_model, can_connect, checked_at }
GET /api/models Admin { status, providers: [{ name, kind, source, base_url, key, replaced_by, models: [{ id, clearance, input_per_mtok_cents, output_per_mtok_cents, default, installed }], check, updated_by, updated_at }], default_model, default_source, search: { state, model, ready, source }, operator_source, version }
POST /api/models/test Admin Body { kind, name?, base_url?, api_key? } or { provider }. Answers { ok, class?, message, offered, suggested }; 429 after ten a minute.
PUT /api/models/providers/:name Admin Body { kind, base_url?, api_key?, models: [{ id, clearance }], skip_check?, version }. Probes first unless skip_check; 422 key_rejected, unreachable, invalid; 409 operator_provider, version; 503 secrets_key_missing.
DELETE /api/models/providers/:name Admin GET /api/models
PUT /api/models/default Admin Body { model, version }; 422 not_installed.
PUT /api/models/providers/:name/models/:model/clearance Admin Body { clearance, confirm_vendor?, version? }: raises (or lowers) one connected model's clearance in one step, as Raise … to … on Models does. A hosted vendor's model raised to restricted needs confirm_vendor: true (the vendor's agreement covers it), else 422 confirm_needed. Recorded as model_clearance_changed, with the run that prompted it when an admin came from Fix this.
PUT /api/models/search Admin Body { on, model?, version }; 409 operator_search when the server's configuration names the embedding models.

The model settings live in the state file's model_settings row, keys sealed, written at the moment of change; nothing of them is in the snapshot.

Method and path Returns
GET /api/llm/models { models: [model ids], governance: { allowed: [{ model, max_sensitivity, region }], default_model } }. With the demo's stub, models is empty and allowed holds mock-default.
GET /api/policy The policy, with the same governance under models.
POST /api/policy/explain { "do": { "op": "llm", "data_class": "pii.customer" }, "actor": "churn-watcher", "for": "maya" } explains a model call without making it: decision.kind and the steps, the first with check: "model".

A run carries model, the model of its last call (null before its first). GET /me/agents gives each agent's model and models (see Asking agents).

A run's model step (kind: llm_call) carries model, input_tokens, output_tokens, cost in cents and estimated: true when the tokens were estimated. Each call is logged as an llm_called event with the model, the caller and the tokens; the Events page lists it under Runs as "Model called".

Streaming#

A plain-text model call can stream: the text arrives as the model writes it, so the coming live voice agent can start speaking within a second. Agents' answers do not stream: an agent answers inside a plan, and plans and tool arguments are never streamed. Nothing streams into a conversation yet.

  • Providers. LlmProvider::complete_stream delivers LlmDelta::Text pieces, then LlmDelta::Done with the usual token counts and cost. Anthropic, OpenAI (Azure, Ollama and compatible servers too) and Gemini stream as server-sent events. A provider that cannot stream, or a server that answers the whole reply at once, delivers it as one piece. The scripted test model streams word by word. A request that answers through a tool comes back whole.
  • The governed call. Kernel::llm_stream is checked like any model call before anything streams: the model must be cleared for the data class, and the budgets and kill switches apply. While the reply streams, its tokens are counted as they arrive. When a budget would be passed, the stream stops before that piece, with "the token budget of N was reached mid-stream (...); the answer was cut off" or the same sentence for a money budget. A kill switch ends the stream within a tenth of a second. A request for JSON or a tool is refused: "plans and tool arguments are never streamed".
  • Stopping. The caller's callback returns false to stop. The connection closes and nothing more is read.
  • Cost. A finished stream is charged the usage the provider reports. A stopped or cut-off stream is charged for what arrived, estimated and never free. Either way it is a Model step and an llm_called event.
  • Tests. ok_rest_fake::sse::model_stream serves each vendor's stream from a script of pieces, with a pause between them (crates/ok-llm/tests/it/streaming.rs, crates/ok-kernel/tests/it/sf_stream.rs).

Live provider tests#

The provider tests run against a local stand-in. Two live tests call the real APIs only when asked:

sh
OK_LIVE_LLM_TEST=1 ANTHROPIC_API_KEY=... OPENAI_API_KEY=... \
  cargo test -p ok-llm --test it hardening::live_ -- --ignored

Speech providers are tested against ok-rest-fake's stand-ins only. The one way real audio reaches a real vendor outside a company's calls is ok speech test, which sends a folder of calls to one provider to compare vendors before choosing. It runs only with OK_LIVE_SPEECH_TEST=1, reads the vendor's key from OK_SPEECH_TEST_KEY and nowhere else, and has the product's own checks; see The speech test.

The speech routes: GET and PUT /api/settings/speech (admins; a key needs a recent sign-in, and a token never carries one) and POST /api/settings/speech/:id/test.