Skip to content

Models and connections

HANI2 can use several language models and try them in order. You set this up in two steps:

  1. Connections sign in to model providers, with an API key or nothing at all for a local server, or run an installed agent harness (Harnesses). Connections are shared by every project and study.
  2. Model chains list the models to try, in order. Each entry names a connection, a model and optional parameters. The first entry that is available is used. A project or a study can have its own chain.

Each session picks a model once from the chain and keeps it. The choice is written to the results, the events and the recording.

Connections

A connection has a name, a provider, a sign-in method, an optional address (base URL) and optional extra headers. Model chains refer to connections by name, so one provider can have more than one connection, for example ollama-local and ollama-cloud, or two OpenAI keys.

Add connections on the Connections page of the admin console (Language models group), or on the command line:

hani2 connections add claude --provider anthropic --key            # asks for the key, stores it
hani2 connections add openai --provider openai --auth api_key_env   # reads $OPENAI_API_KEY
hani2 connections add ollama-cloud --provider ollama_cloud --key
hani2 connections add gpu-box --provider ollama --base-url http://gpu-box:11434
hani2 connections add pi-claude --provider pi --upstream anthropic --auth api_key_env   # a harness
hani2 connections list
hani2 connections test claude --model claude-sonnet-5-5

Sign-in methods

Method What it is Where the secret is kept
api_key A key pasted into the console (or typed after --key). settings/secrets/connections.json, readable only by the server's user (mode 0600).
api_key_env The name of an environment variable that holds the key. The server's environment.
none Nothing: a local server, or credentials the provider reads from the environment (Amazon Bedrock). —

Connections and secrets live only in the settings folder, never in a project or study folder. The console, the API and the command line show keys masked (sk-…89). Keys, tokens and header values are never written to results, events, recordings or LLM call logs. Errors that contain a stored secret are masked before they are shown or recorded.

Implicit connections. Every provider also has a connection you do not need to add. It is named after the provider and reads the provider's usual environment variable, for example anthropic reads ANTHROPIC_API_KEY and openai reads OPENAI_API_KEY. The implicit ollama connection is the local server (OLLAMA_API_BASE or http://localhost:11434). There is also an ollama-local connection (HANI2_OLLAMA_LOCAL_BASE or http://localhost:11434). Turn on Show implicit on the Connections page to see them.

Providers

Every call goes through litellm, so any provider litellm supports can be used. To use one that has no preset, pick Other litellm provider and give litellm's name for it, for example together_ai, xai or vertex_ai. These providers have presets:

Provider (provider) API key Subscription Notes
Anthropic (anthropic) yes no Anthropic does not permit third-party applications to sign in with Claude Free, Pro, Max or Ultra plans, or to route requests through those plans' credentials. Developers must use an API key from the Claude Console (Anthropic's legal and compliance page). Models: claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-2. Claude 5 models refuse sampling parameters, so HANI2 leaves out temperature, top_p and top_k for them.
OpenAI (openai) yes not offered See Subscription sign-ins.
Ollama Cloud (ollama_cloud) yes (OLLAMA_API_KEY) no Calls https://ollama.com directly with a key from ollama.com/settings/keys (Ollama's authentication page).
Ollama, local server (ollama) — — Local models (qwen3:4b-instruct). Cloud models through the server (names ending in -cloud) are accepted and use the server's ollama signin account; check that the account's plan covers your use.
GitHub Copilot (github_copilot) — not offered See Subscription sign-ins.
Google Gemini (gemini) yes (GEMINI_API_KEY) no
OpenRouter (openrouter) yes (OPENROUTER_API_KEY) no
Groq, Mistral, DeepSeek (groq, mistral, deepseek) yes no
Azure OpenAI (azure) yes (AZURE_API_KEY) no Give the resource endpoint as the address and api_version as a parameter.
Amazon Bedrock (bedrock) — — Uses the server's AWS credentials.
OpenAI-compatible server (openai_compatible) optional — vLLM, LM Studio, a gateway: give the /v1 address.
Other litellm provider (litellm) optional — Any litellm provider, by litellm's name.
Claude Code, Codex, pi (claude-code, codex, pi) yes no Agent harnesses; see Harnesses.

hani2 connections providers prints the same table. The Providers and sign-in methods list on the Connections page shows what each preset was checked against.

Subscription sign-ins are not offered

HANI2 serves study participants, so a sign-in is offered only when the provider's terms clearly allow a third-party application to use it that way. No personal plan sign-in passes that test (checked on 2026-11-18):

Sign-in What the provider says HANI2
Claude plans (Free, Pro, Max, Ultra) "Anthropic does not permit third-party developers to offer Claude.ai login into their own applications, or to route requests through Free, Pro, Max, or Ultra plan credentials on behalf of their users." (Anthropic's legal and compliance page) API keys only.
ChatGPT plans Requests "must originate from the user's local runtime or a remote runtime only that user controls"; prohibited: "Using one user's subscription to fulfill another user's requests." (Sign in with ChatGPT terms); "You may not share your account credentials or make your account available to anyone else" (Terms of Use). Not offered.
GitHub Copilot (device sign-in and Copilot token exchange) The token exchange is not a documented public API; "Your login may only be used by one person" (GitHub Terms of Service). The documented route for multi-user apps is the Copilot SDK with each user's own GitHub sign-in and plan (Copilot SDK with GitHub OAuth), a different mechanism. Not offered.
Ollama account (ollama signin, -cloud models through a local server) The feature is documented (authentication); Ollama's pricing describes one account per person, with shared use on the Team plan, and the terms apply. Accepted: the model runs with the server's own sign-in. Check that the account's plan covers your use.

A connection stored by an earlier version with a subscription sign-in (ChatGPT or Copilot) still loads, disabled: it never resolves, every chain entry that names it is skipped with this reason, and the Connections page shows it so you can remove it. The chatgpt: and copilot: entry prefixes are skipped the same way.

Model chains

A chain is a list of entries. Each entry gives:

Key Meaning
connection The connection to use, by name.
provider Instead of connection: use the provider's first connection (or its implicit one).
model The model id, as the provider names it.
params Optional parameters passed to the call: thinking and effort (or reasoning, reasoning_effort; see Thinking and effort), temperature, max_tokens, top_p, top_k, seed, stop, frequency_penalty, presence_penalty, num_ctx (Ollama's context length; see Entry settings) and any other parameter the provider takes. Keys, tokens, headers and addresses are refused here; they belong to a connection.
label An optional name shown in the console and the results.

Entries are identified by their position, so a model can appear more than once with different parameters, and a provider can appear more than once with different models. An entry can also be written as a short connection:model or provider:model text. Only the first colon splits it, so ollama:qwen3:4b is the model qwen3:4b of Ollama.

Chains are kept per purpose, in a models.json file:

models.json
{
  "default": [
    {"connection": "claude", "model": "claude-sonnet-5-5", "params": {"max_tokens": 1500}},
    {"connection": "ollama-cloud", "model": "gpt-oss:120b"},
    {"connection": "ollama-cloud", "model": "gpt-oss:120b", "params": {"temperature": 0.1}, "label": "cool"},
    "ollama:qwen3:4b-instruct"
  ],
  "judge": ["claude:claude-opus-5-5"]
}
Purpose Used by
default Every purpose without its own chain.
assistant The Assistant and its autopilot.
opponent LLM opponents (negmas-llm negotiators).
tools Tools built on LLMTool or calling Tool.ask_llm(), and hani2.llm_service.complete().
text Writing a message for an offer, reading an offer out of a message, and the admin LLM tool.
judge The evaluation judge (LLM metrics of recordings).

A bare list is the default chain. Edit chains on the Models page of the admin console. It works per layer (settings folder, project or study, like every other setting). There you can reorder, duplicate and remove entries, edit their parameters, test one entry, and press Test chains to see which entry each purpose resolves to now, with the reason each skipped entry was skipped.

Where a chain comes from

For each purpose, HANI2 looks at these places in order. The first one that gives a chain for the purpose, or a default chain, wins:

  1. the active study's models.json;
  2. its project's models.json;
  3. the start-time list, from hani2 --models … or HANI2_MODELS;
  4. the settings folder's models.json, which is the admin's global chain;
  5. the old single-model settings: provider and model in assistant_settings.json (for the Assistant) and in llm_settings.json (for everything else), read as a one-entry chain.

When a study is active, its settings override everything else, including the start-time list. A study's default chain also beats a per-purpose chain set further down, for example an assistant chain in the settings folder. Old provider/model keys written in a study's or project's own assistant_settings.json or llm_settings.json count as that layer's chain, as long as the layer has no models.json.

Example. The server runs with hani2 --models "anthropic:claude-sonnet-5-5,ollama:qwen3:4b". The settings folder's models.json has {"default": ["openai:gpt-5"], "judge": ["openai:gpt-5-mini"]}. Study HAN2027/pilot has models.json with ["ollama-cloud:gpt-oss:120b"].

Session Assistant Judge
In study HAN2027/pilot ollama-cloud:gpt-oss:120b (the study) ollama-cloud:gpt-oss:120b (the study)
In another study, with no chain of its own claude-sonnet-5-5, else qwen3:4b (start list) the same (start list)
Server started without --models openai:gpt-5 (settings) openai:gpt-5-mini (settings)

hani2 models list [--study P/S] prints the chain each purpose uses and where it comes from. hani2 models resolve [--study P/S] [--purpose assistant] also checks the providers and prints the entry each purpose would use now.

The start-time list

hani2 --models "anthropic:claude-sonnet-5-5,openai:gpt-5,ollama:qwen3:4b"
HANI2_MODELS="openai:gpt-5,ollama:qwen3:4b" hani2

The list is a comma-separated provider:model or connection:model list. For each provider it uses the provider's first connection, or its implicit one. It replaces the settings folder's chains for every purpose. A project's or a study's own chain still wins. hani2 refuses a list it cannot read, and it refuses --models when HANI2_MODELS is set to a different list.

Named sequences

A sequence is a chain with a name. Besides the purposes above, a models.json can define as many named sequences as you want, under sequences, and a purpose can name a sequence instead of giving a chain:

models.json
{
  "default": ["claude:claude-sonnet-5-5", "ollama:qwen3:4b-instruct"],
  "judge": "judge-strict",
  "sequences": {
    "judge-strict": [{"connection": "openai", "model": "gpt-5", "params": {"effort": "high"}}],
    "cheap": {"entries": ["anthropic:claude-haiku-5-5", "ollama-local:qwen3:4b-instruct"],
              "description": "Short answers, quickly"},
    "large": {"disabled": true}
  }
}
Form Meaning
"name": [entries] A sequence (entries as in a chain).
"name": {"entries": [...], "description": "..."} The same, with a description shown to admins and to the Assistant.
"name": {"disabled": true} Hide a sequence inherited from a less specific layer or from the built-ins.
"purpose": "name" The purpose (default, assistant, opponent, tools, text, judge) uses that sequence.

Built-in sequences. Every installation has these. Entries whose provider has no connection are skipped, as in any chain.

Name Entries, first choice first
default The default chain above (it is the default purpose).
judge The judge's own chain (the judge purpose; without one, the default chain).
tiny qwen3:0.6b, then gemma3:270m, on the local Ollama server.
offline qwen3:4b-instruct, qwen3:8b, qwen3:0.6b, all on the local Ollama server (connection ollama-local), so nothing leaves the machine.
small Claude Haiku 5.5, GPT-5 mini (effort: low), local qwen3:4b-instruct.
medium Claude Sonnet 5.5, GPT-5 (effort: medium), local qwen3:30b-a3b.
large Claude Opus 5.5 (effort: high), GPT-5.5 (effort: high).

Pull the local models you want with ollama pull qwen3:0.6b (and so on).

Where a sequence comes from. Named sequences merge by name. For each name, the most specific layer that mentions it wins: the study, then its project, the start-time settings file, the settings folder, and last the built-ins. So a study that defines only cheap still sees the settings folder's large, and a project can disable large for all its studies while one study defines it again. default, judge and the other purposes keep the rule of the previous section. A layer's models.json that holds only sequences does not hide the purposes' chains of the layers below it.

On the Models page, the Named model sequences group lists every sequence at the layer with its source. Override here copies an inherited sequence to this layer for editing, Disable here hides it, and Use the inherited one removes this layer's version. Add a sequence creates a new one. Each purpose can be switched from its own chain to a named sequence. Test chains also shows the entry each sequence resolves to.

hani2 models list prints the sequences too, and hani2 models resolve --sequence small checks one.

Who uses a sequence.

  • A purpose that names it ("judge": "judge-strict").
  • The Assistant, for its replies and any other task, with the model_choice ability (off by default), or the sequence its author set in code: see The Assistant's model sequences.
  • A tool: self.ask_llm(prompt, sequence="small"), or hani2.llm_service.complete(prompt, session=s, sequence="small").
  • Code: model_chain.completion("tools", messages, sequence="small"). An LLM opponent or autopilot driver gets one through make_agent(..., sequence="small").

A session chooses each sequence's entry the first time it uses it and keeps it, as with a purpose. The record says which sequence it came from (sequence). In llm_models it is stored under purpose@sequence, for example assistant@small. When the Assistant replies through a sequence, assistant_llm and assistant_llm_entry name that sequence's entry. Asking for a disabled or unknown sequence fails with an error that says why. A purpose that names a missing or disabled sequence also fails visibly: it does not quietly use another layer's chain. The Models page and PUT /api/admin/models refuse to save one, and hani2 reports one in the settings folder at start.

Thinking and effort

Parameter Values What is sent
effort none, minimal, low, medium, high, xhigh, max (as far as the model supports them) reasoning_effort. litellm translates it for each provider.
thinking true, false, or a token budget (2048) Ollama: think: true/false (gpt-oss models take the effort instead). Anthropic and Gemini: a budget becomes thinking: {"type": "enabled", "budget_tokens": n}. Others: true without an effort means effort: medium, and false leaves the effort out. A mapping is passed as the provider's own thinking parameter.

thinking: false is safe for every Ollama model. thinking: true, or an effort, is refused by Ollama models that cannot think (for example smollm2), and that error is not retried with the next entry. Set it only for models that support it. Claude 5 models get no temperature, top_p or top_k, whatever the entry says.

Entry settings

In the admin console each entry has a settings button (the sliders, showing the parameters set). It opens the entry's settings, with a control for each of the settings below. They are the ones most providers take:

Setting Key What it does
Thinking thinking On or off (Ollama thinking models), or a token budget (Anthropic, Gemini). For the other providers thinking is set by the effort.
Effort effort How hard a reasoning model thinks; the list shows the levels the provider takes.
Temperature temperature Randomness: 0 is the most predictable.
Max output tokens max_tokens The longest reply (thinking included for most models).
Top p, top k top_p, top_k Sample only from the most likely tokens.
Seed seed The same seed gives the same reply where the provider supports it.
Stop sequences stop Texts that end the reply.
Frequency and presence penalty frequency_penalty, presence_penalty Fewer repeated words; more new topics.
Context length num_ctx Ollama: the context window in tokens.
Other parameters any Anything else the provider takes, as name=value.

What the model takes is checked when the settings open. Known models are checked against litellm's model list; Ollama models are checked by asking the Ollama server (/api/show, whether the model thinks); a harness takes what it passes on. Each setting is then shown as taken, refused or unknown:

  • A refused setting is hidden unless the entry already has it. In that case it is shown with a warning.
  • A model that could not be checked, or is not in the lists, gets every control.
  • The settings never fail a call. A common setting the model is known to refuse is left out of the request instead of being sent, so a setting left over from another model never breaks a call.

The console writes one key per setting. An older reasoning_effort or reasoning becomes effort, and parameters without a control stay as they are under Other parameters.

The Assistant's model sequences

Two abilities of the Assistant are about models. Only the admin decides them (in the Assistant settings of any layer); participants neither see nor switch them.

Ability Default What it allows
model_choice off Pick any of the study's named sequences, for its replies and for any other task that uses a model.
own_models off Define its own sequences for the session, signed in with its own keys or servers, and use them.

To turn one on, switch it on under Abilities granted on the console's Assistant settings page, or set it in assistant_settings.json (in the settings folder, a project or a study):

{"capabilities": {"model_choice": true}}

An Assistant uses them from Python:

from hani2.assistant import Assistant


class MyAssistant(Assistant):
    model_sequence = "small"            # its replies use the `small` sequence

    def on_event(self, event, data):
        if event == "negotiation_ended":
            summary = self.ask_llm("Summarise the negotiation ...", sequence="large", effort="high")
Helper What it does
model_sequence (class attribute) The sequence its replies use ("": the assistant chain). Needs no ability: it is the author's choice.
model_sequences() The sequences it may use: name, description, source and entries (never a key).
use_model_sequence(name) With model_choice: switch its replies to name ("" goes back to the assistant chain).
ask_llm(prompt, sequence=..., system=..., **params) One prompt, one reply. Without sequence it uses model_sequence; any other sequence needs model_choice.
define_model_sequence(name, entries, description="") With own_models: define its own sequence (each entry signs in by itself).

The language model behind the Assistant gets the functions list_model_sequences and use_model_sequence (with model_choice or own_models), and define_model_sequence (with own_models). It can, for example, switch to small for small talk and to large for a hard analysis.

Without model_choice, an Assistant whose class sets model_sequence = "small" still answers through small, but neither its code nor its language model can switch to another sequence, and the language model does not get these functions.

Its own sequences. With own_models, an Assistant can use its own models. Every entry of its own sequence signs in by itself, with api_key, api_base or both:

self.define_model_sequence("mine", [
    {"provider": "openai", "model": "my-model", "api_base": "https://models.example.org/v1",
     "api_key": "sk-...", "params": {"temperature": 0.2}},
    {"provider": "anthropic", "model": "claude-haiku-5-5", "api_key": "sk-ant-..."},
    {"provider": "ollama", "model": "my-finetune", "api_base": "http://my-gpu-box:11434"},
])
self.use_model_sequence("mine")

An own entry never uses the server's connections, keys or environment variables. An entry without api_key sends no key, even to the provider's own address, so an address the Assistant chooses never receives one of the server's keys. Plain provider:model entries, connection and api_key_env are refused. The study's models are used only through its named sequences (with model_choice), and a sequence the admin disabled stays disabled.

api_key is used only for the session's calls. It is masked in every log and error, and it is never stored or written to results, events or recordings. A sequence lives as long as the session. Its name must not be one the study already uses, so an Assistant cannot replace the admin's judge or small. Harness providers cannot be used.

Choosing an entry

An entry is available when its connection exists, has credentials (a key, a set environment variable, a sign-in) and passes a quick check:

Provider Check
Ollama (local and cloud) /api/tags lists the model.
Anthropic /v1/models accepts the key and lists the model.
OpenAI, OpenRouter, Groq, Mistral, DeepSeek, OpenAI-compatible /models accepts the key and lists the model.
Gemini /v1beta/models lists the model.
A harness The harness is installed, the key is present and the model is allowed (no request: a harness call is slow and costs money).
Bedrock, Azure, other litellm The credentials are present (no request).

Checks time out after 3 seconds (HANI2_MODEL_PROBE_TIMEOUT). Their results are cached: for 5 minutes when the check passes and 30 seconds when it fails. So starting a session never waits long for a provider that is down. With HANI2_MODEL_PROBE=off, only the credentials are checked and nothing is sent over the network.

When a session chooses. The Assistant's model is chosen when the session starts. The models of the other purposes are chosen the first time the session needs them, for example when an LLM opponent is created. Each choice is then kept for the whole session.

When a call fails. A call can fail hard: it cannot connect, the sign-in is refused, the model is not found, the provider is overloaded or rate limited. HANI2 then moves the session's purpose to the next available entry and retries the call, and records the switch as a model_fallback event. HANI2 recognises these from the error's type and HTTP status (401, 402, 403, 404, 408, 429 and 5xx), or from a message that says the model is not found or does not exist. Other errors are not retried, for example a request the model rejects, or a message that only mentions that something else (a tool, a file) was not found. When no later entry is available, the call fails with its own error and the session keeps its entry, so the next call tries it again. LLM opponents call the model themselves, so they keep the entry they were created with until the end of their negotiation.

When nothing is available. A chain you set up (study, project, start-time list or settings folder) with no available entry fails visibly. The session shows a banner and a toast, and logs an error event (model_unavailable) with every skipped entry and why it was skipped. The old single-model settings work as before: when their check fails, HANI2 still uses them unchecked (status: unverified), so an install that never set up a chain behaves as it always did.

An Assistant's own settings. Without any chain, an Assistant whose own settings name a different provider and model (for example from a group file) uses that model. Any chain wins over those keys.

Claude 5 models, through any provider (Anthropic, OpenRouter, Bedrock), get no temperature, top_p or top_k. The Claude models that refuse a forced tool choice (Opus 5.5, Sonnet 5.5, Fable 5.1 and 5.2) are asked for an action with tool_choice: auto.

Old local Ollama fallback. Old settings that point Ollama at a remote server (api_base, or OLLAMA_API_BASE, for example https://ollama.com) read as two entries: the remote server first, then the local server (HANI2_OLLAMA_LOCAL_BASE, default http://localhost:11434). A model the remote server does not have is found locally.

Harnesses

A harness connection calls the model through an installed agent harness instead of calling the provider's API directly: Claude Code (through the Claude Agent SDK), the Codex CLI or pi. It appears in model chains like any other connection ({connection, model, params}), has a check and falls back the same way. Use one to compare the Assistant or the judge with what a harness does with the same prompt, or to reach models through pi's provider set.

pip install 'hani2[harness]'      # the Claude Agent SDK (it bundles its own claude CLI); codex and pi need only their CLIs
hani2 connections add judge-claude --provider claude-code --auth api_key_env   # reads $ANTHROPIC_API_KEY
hani2 connections add judge-codex --provider codex --key                        # an OpenAI API key
hani2 connections add pi-claude --provider pi --upstream anthropic --key        # pi with an Anthropic key
hani2 connections add pi-local --provider pi --upstream ollama --auth none      # pi with a local Ollama
hani2 connections test pi-local --model qwen3:4b-instruct                      # a tiny request through the harness

HANI2_CLAUDE_PATH, HANI2_CODEX_PATH and HANI2_PI_PATH choose a harness's executable (default: the SDK's bundled CLI, then claude, codex and pi on PATH).

What each harness can do

Harness Completion The Assistant's functions Purposes How it runs
Claude Code (claude-code) yes yes (in-process MCP server) judge and the console's Test only One Agent SDK query() per call.
Codex CLI (codex) yes no judge and the console's Test only One codex exec --json per call, without any tool.
pi (pi) yes yes (a bridge extension over RPC) every purpose One pi --mode rpc per call.

Completion (system prompt and messages in, text out) serves text extraction and writing, LLMTool and Tool.ask_llm(), the judge and LLM opponents. Calls reach the harness through a litellm custom provider, so code that calls litellm itself (negmas-llm opponents) works unchanged. A call that passes function schemas through litellm is refused (only the Assistant's functions run through a harness).

The Assistant's functions. The harness runs the turn. Each function it calls is executed by the Assistant's own dispatcher, so capabilities, the agent_action events and the recording apply as with any other model, and the call and its result are added to the Assistant's conversation as an ordinary tool call. In an autopilot turn, the first action ends the turn's actions. A harness without safe function calling (Codex) is skipped for the assistant purpose with the reason.

A conversation with earlier turns is sent as one prompt that writes out the history, with the function calls and results. Each call starts a new harness session, so nothing is kept between calls.

Usage rules

Only API keys (or a local Ollama server for pi) are allowed: never a personal subscription, and never the server user's own sign-in to the harness. Checked on 2026-11-18:

Harness Provider What the sources say Enforced in HANI2
Claude Code Anthropic "Developers building products or services that interact with Claude's capabilities, including those using the Agent SDK, should use API key authentication through Claude Console or a supported cloud provider. Anthropic does not permit third-party developers to offer Claude.ai login into their own applications, or to route requests through Free, Pro, Max, or Ultra plan credentials on behalf of their users." On running Claude Code in products: "Customers may not pay for, resell, or intermediate Claude usage on their end users' behalf. Each end user must authenticate with their own Anthropic API key, Claude subscription plan credentials, or 3P inference provider credential" (legal and compliance; Agent SDK overview). API key only (--bare: "OAuth and keychain are never read"); an isolated config folder. The Agent SDK's licence speaks of powering "products and services that you make available to your own customers and end users", but the end-user condition above cannot be met by study participants; where the terms leave doubt HANI2 does not take the risk, so Claude Code serves only the judge and the console's Test, never participants (HANI2's conservative reading; ask Anthropic for your case). For participants, use the anthropic provider (the API with a key).
Codex CLI OpenAI "Use API key authentication for programmatic Codex CLI workflows, such as CI/CD jobs. Don't expose Codex execution in untrusted or public environments." (authentication); "App-server authentication has never been permitted for commercial or hosted services." (app-server); ChatGPT plans: see above. API key only, through a custom model provider that reads OPENAI_API_KEY (requires_openai_auth = false, forced_login_method = "api"); an isolated CODEX_HOME; no app-server; no tools; serves only the judge and the console's Test.
pi any API-key provider; local Ollama pi is open source (github.com/earendil-works/pi) and can sign in to personal plans (Claude Pro/Max, ChatGPT, GitHub Copilot and others) by OAuth; those plans' own terms (above) apply. An isolated agent folder (PI_CODING_AGENT_DIR) whose auth.json is reset to {} before every call, so no stored pi login is ever used; one API key, for one allowed upstream (Anthropic, OpenAI, Google Gemini, Mistral, Groq, DeepSeek, OpenRouter) or a local Ollama server; OAuth-only upstreams (openai-codex, github-copilot) are refused.

Safety

Participants' text reaches the prompts, so every harness runs locked down:

Claude Code Codex CLI pi
Built-in tools none (tools=[]); only HANI2's functions (mcp__hani2__…) are allowed, with permission_mode="dontAsk" none: shell, exec, image, goals, multi-agent, plugins, apps, hooks, memories, browser and computer use are disabled, web search is off, and the model's entry comes from Codex's bundled catalog with its patch and code-mode tools removed (a model not in the catalog is refused); read-only sandbox and approval_policy = "never" as a backstop none (--no-tools, --tools lists only HANI2's functions)
Configuration setting_sources=[], --strict-mcp-config, --bare, --disable-slash-commands, no auto memory, CLAUDE_CONFIG_DIR and HOME isolated CODEX_HOME and HOME isolated, --ignore-user-config, --ignore-rules, project_doc_max_bytes = 0, --ephemeral PI_CODING_AGENT_DIR and HOME isolated, --no-extensions (only HANI2's bridge), --no-mcp, --no-skills, --no-prompt-templates, --no-context-files, --no-approve, --offline, --no-session
Participant text sent verbatim (verbatim_prompts: no @file expansion, no slash commands) on stdin, never in the command line a leading /, ! or @ is escaped; no commands exist
System prompt HANI2's (system_prompt) HANI2's (model_instructions_file) exactly HANI2's (the bridge replaces pi's)

For every harness: the child's environment is built from an allowlist (PATH, locale, proxy and certificate variables), never copied from the server's, so OAuth tokens and other keys of the server never reach it; Claude Code's SDK merges its environment over the server's, so a launcher reduces it again before the CLI starts. Each call runs in a new empty temporary folder, with caps on time (params.timeout, default 120 s) and turns (params.max_turns, default 8 with functions, 1 without; Claude Code also takes params.max_budget_usd). params.effort sets the reasoning effort where the harness has one. Keys never appear in a command line, an event, a result or a recording, and errors are masked like every other error. Each connection's private folder is settings/secrets/<connection>/harness/ (0700); removing the connection deletes it.

Limits

  • Speed. A harness starts a process for each call (seconds, not milliseconds), so it is slower than an API call, most of all for LLM opponents, which call the model on every offer.
  • Cost. The harness adds its own system prompt and, with functions, several model turns per call. Claude Code and pi report a cost (cost in the recording); Codex reports tokens only.
  • Checked against version. The lockdown was checked against Claude Code 2.1.327 (Agent SDK 0.2.184), Codex CLI 0.162.1 and pi 1.4.0 by capturing what each sends to a local stand-in server: only HANI2's system prompt, the prompt and HANI2's functions (Codex: none). A new harness version may add tools; Codex is run with --strict-config, so an option it no longer knows stops the call instead of being ignored.
  • Reproducibility. The harness version changes what the model sees (system prompt, tool descriptions). The Connections page shows each harness's version; pin it for a study. The check sends no request, so a wrong model name shows only on the first call (then the chain falls back).
  • Claude Code through Amazon Bedrock or Google Vertex is not offered yet; use an Anthropic API key.

What is recorded

Where What
results.csv (columns added after the existing ones) assistant_llm and opponent_llm (connection:model); assistant_llm_entry and opponent_llm_entry (<source>#<position>, e.g. study:HAN2027/pilot#2); llm_models: a JSON record of every purpose the session used.
Events model_resolved when a purpose is chosen, model_fallback when a hard failure moves it on, error/model_unavailable when nothing is available.
Recordings (.hrec) The same events, plus models in the start record and the Assistant's model in support_agent.

Each record holds the purpose, the status (ok, unverified or none), the source layer, the position in the chain and its length, the label, the connection, the provider, the sign-in method, the model, the litellm model string, the entry's parameters, the skipped entries with their reasons, and any error. It never holds a key, a token or a header value.

Admin API

All of these are admin only.

Endpoint What it does
GET /api/admin/providers The provider table, the purposes and the harnesses (harnesses: installed?, version, sign-in, purposes).
GET /api/admin/connections The connections, masked (?implicit=false leaves out the implicit ones).
POST /api/admin/connections Add one: {name, provider, auth, api_key?, api_key_env?, base_url?, litellm_provider?, upstream?, headers?}.
PUT / DELETE /api/admin/connections/{name} Change (a missing api_key keeps the stored one) or remove one.
POST /api/admin/connections/{name}/test Check the credentials, and {model} if given; lists the provider's models when it can. For a harness, sends a tiny request through it and returns the reply.
DELETE /api/admin/connections/{name}/login Delete a connection's stored tokens (subscription sign-ins are not offered).
GET /api/admin/models?layer=… A layer's own chains, the chains in effect there and what it inherits (with their sources); sequences and inherited_sequences: every named sequence there (source, disabled, description, entries); builtin_sequences.
PUT /api/admin/models?layer=… Replace a layer's chains ({} removes them). As with every setting, a console opened in a study must name the layer (409 otherwise).
POST /api/admin/models/resolve?layer=… Which entry each purpose (purposes) and each named sequence (sequences) resolves to; {chains} tries a models.json you have not saved yet, {purpose} or {sequence} checks only one.
POST /api/admin/models/test-entry Check one entry; with "call": true, also send a one-word request.
POST /api/admin/models/entry-options What an entry's model takes, {entry} → thinking (support, kind: toggle, budget or effort), effort (support, levels), params (each common setting yes, no or unknown), sources. Never fails for an unknown model.

Connection endpoints accept no layer other than settings. models is also a settings kind of /api/admin/settings/{kind}, and that endpoint checks chains in the same way.

From Python

from hani2 import model_chain

res = model_chain.resolve("assistant")          # the first available entry
print(res.short(), res.record())                # "claude:claude-sonnet-5-5", the record above
reply = model_chain.completion("tools", [{"role": "user", "content": "Hi"}])
reply = model_chain.completion("tools", [{"role": "user", "content": "Hi"}], sequence="tiny")
model_chain.effective_sequences()               # every named sequence at the current layer

In a tool, self.ask_llm(prompt) uses the session's tools model. session.models holds the entries the session uses (session.models.get("opponent")). See the Python API.