Skip to main content

Chimera — Dynamic Multi-Model Deliberation Gateway

Chimera Banner

CI PyPI License: MIT Python 3.11+

One API call. A team of models. One answer.

Chimera takes your prompt, dispatches it to a hand-picked team of LLMs (each with a custom subtask scoped to their strengths), and an aggregator merges their outputs using dispatcher-written instructions. One dispatcher model call designs the entire deliberation at once.

Quickstart

# Install (choose one)
pip install chimera-deliberation[full]        # full CLI + server in a venv
pipx install chimera-deliberation[full]       # same, isolated in its own env
pip install chimera-deliberation[server]      # API server only

# Configure
cp chimera.yaml.example chimera.yaml
# Add your API keys (at minimum: DEEPSEEK_API_KEY)

# Run
chimera "What is the capital of France?"      # CLI deliberation
chimera run "Compare React and Vue"           # explicit `run` subcommand (same as above)
chimera serve                                 # REST API + web UI (see Server & MCP)
chimera-mcp                                   # MCP tools for agents

Open http://localhost:8765/web/ for the web UI with live DAG visualization.

Python:

# If chimera.yaml is missing, create it before calling load_config():
chimera config init        # pip/pipx installs — template ships inside the wheel
# Repo checkouts can instead copy the checked-in template:
# cp chimera.yaml.example chimera.yaml
# Missing template? Reinstall to restore it:
# error: chimera.yaml.example not found — reinstall chimera-deliberation to restore the template.

load_config() finds the config in this order: explicit path argument, then the CHIMERA_CONFIG env var, then a walk-up from the current directory.

import asyncio

from chimera import Engine, LiteLLMGateway, load_config

config = load_config()
engine = Engine(config, LiteLLMGateway(config))
result = asyncio.run(engine.deliberate("Explain quantum computing."))
print(result.answer)  # merged output from multiple models

OpenAI-compatible:

curl -X POST http://localhost:8765/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "auto", "messages": [{"role": "user", "content": "Hello"}]}'

Documentation

Detailed guides live in docs/:

Guide Contents
docs/CONFIG.md Full configuration reference (chimera.yaml, categories, model selection)
docs/USAGE.md CLI usage and examples
docs/INTEGRATION.md Integrate Chimera into your app (deployment, clients, auth, errors)
docs/OPENAI_API.md OpenAI-compatible API contract
docs/SECURITY.md Security model and credential handling
docs/EDGE_CASES.md Edge cases and behavior notes
docs/FAILURE_RESILIENCE.md Failure handling and resilience design
docs/RESILIENCE.md Resilience guarantees and degradation semantics

Architecture

flowchart TB
    subgraph Client
        A[User Prompt]
    end

    subgraph Dispatcher["Dispatcher (1 call)"]
        B[Designs DAG<br/>Picks models by category<br/>Writes custom prompts<br/>Writes merge instructions]
    end

    subgraph Workers["Workers (parallel)"]
        C1[Worker A<br/>domain-scoped task]
        C2[Worker B<br/>domain-scoped task]
        C3[Worker C<br/>domain-scoped task]
    end

    subgraph Aggregation
        D[Aggregator<br/>merges with dispatcher instructions]
    end

    A --> B
    B --> C1
    B --> C2
    B --> C3
    C1 --> D
    C2 --> D
    C3 --> D
    D --> E[Final Answer]

Formation Types

flowchart LR
    subgraph Simple["Simple (2 workers)"]
        S1[W1] --> SA[Aggregator]
        S2[W2] --> SA
    end

    subgraph Debate["Debate (3 workers + merge)"]
        D1[W1] --> DA1[Agg 1]
        D2[W2] --> DA1
        D2 --> DA2[Agg 2]
        D3[W3] --> DA2
        DA1 --> DM[Merge]
        DA2 --> DM
    end

    subgraph Custom["Custom DAG (client-defined)"]
        C1[Researcher] --> C2[Critic]
        C2 --> C3[Polisher]
        C3 --> C4[Final]
    end

Flow: Request to Answer

sequenceDiagram
    participant Client
    participant Engine
    participant Dispatcher
    participant Workers
    participant Aggregator

    Client->>Engine: POST /v1/chat/completions
    Engine->>Dispatcher: Design formation
    Dispatcher->>Dispatcher: Pick models by category weights
    Dispatcher->>Dispatcher: Write per-worker prompts + merge instructions
    Dispatcher-->>Engine: DAG + prompts + instructions

    par Workers (parallel)
        Engine->>Workers: Worker A (custom prompt)
        Engine->>Workers: Worker B (custom prompt)
        Engine->>Workers: Worker C (custom prompt)
        Workers-->>Engine: responses
    end

    Engine->>Aggregator: Merge with dispatcher instructions
    Aggregator-->>Engine: Final answer

    Engine-->>Client: JSON response + trace

Server & MCP

chimera serve starts the REST API plus the web UI:

  • http://localhost:8765/v1/chat/completions — OpenAI-compatible endpoint
  • http://localhost:8765/docs — OpenAPI docs
  • http://localhost:8765/web/ — web UI with live DAG visualization

Health probes (all return JSON):

  • http://localhost:8765/health — alias of the liveness probe (always 200 when the process is alive)
  • http://localhost:8765/v1/health — health check (healthy / degraded / unhealthy)
  • http://localhost:8765/v1/health/ready — readiness probe (200 when ≥1 provider reachable, 503 otherwise)
  • http://localhost:8765/v1/health/live — liveness probe (always 200 when alive)

chimera-mcp runs the MCP server over stdio so AI agents (Hermes, Claude Code, etc.) can call Chimera directly. Both read the same chimera.yaml configured in Quickstart.

Model Selection

The dispatcher picks models using category-weighted scoring:

Category What it measures
code Programming, debugging, software engineering
analysis Data analysis, research, evaluation
reasoning Logic, math, complex problem-solving
design Creative work, UX, content generation
audit Fact-checking, safety, correctness review

Each model in the catalog has a score (0.0–1.0) per category. The dispatcher matches task domains to model strengths. You can override any model choice per request:

{
  "model": "auto",
  "messages": [{"role": "user", "content": "..."}],
  "dispatcher_model": "deepseek/deepseek-v4-flash",
  "aggregator_model": "z-ai/glm-5.2",
  "worker_model": "deepseek/deepseek-v4-pro",
  "allowed_models": ["deepseek/deepseek-v4-pro", "z-ai/glm-5.2"],
  "stage_models": {"worker_1": "openrouter/anthropic/claude-sonnet-4"}
}
  • dispatcher_model — model for the planning/dispatch call itself.
  • aggregator_model — forces every aggregator/merge/audit stage.
  • worker_model — forces every worker stage.
  • stage_models — per-stage overrides; these win over the global ones above.
  • Config locks (defaults.lock_aggregator: true / defaults.lock_dispatcher: true) force the configured default for that role and discard the request override. A discarded override is never silent: it is recorded in the trace's dispatch_note (e.g. override discarded: aggregator_model='X' ignored (lock_aggregator=true)).

Custom DAGs

Send your own formation structure at request time. The example below is the complete request body for POST /v1/chat/completions with "model": "custom" — that endpoint is the custom-DAG contract (POST /v1/deliberate does not accept formation custom):

{
  "model": "custom",
  "allow_custom_dag": true,
  "dag": {
    "stages": [
      {"id": "researcher", "kind": "worker", "model": "openrouter/anthropic/claude-sonnet-4"},
      {"id": "critic", "kind": "aggregator", "model": "z-ai/glm-5.2", "depends_on": ["researcher"]},
      {"id": "polisher", "kind": "worker", "model": "deepseek/deepseek-v4-pro", "depends_on": ["critic"]},
      {"id": "final", "kind": "aggregator", "model": "openrouter/anthropic/claude-sonnet-4", "depends_on": ["polisher"]}
    ],
    "edges": [["researcher","critic"], ["critic","polisher"], ["polisher","final"]]
  },
  "messages": [{"role": "user", "content": "..."}]
}

The dispatcher writes custom prompts for each stage but uses YOUR structure exactly.

Interfaces

Interface Endpoint Use
REST API POST /v1/chat/completions OpenAI-compatible drop-in
REST API POST /v1/deliberate Full control (DAG, overrides, trace)
REST API GET /v1/models Model catalog with weights
REST API GET /v1/formations Available formation presets
CLI chimera run Command-line usage
MCP chimera_deliberate Hermes / AI agent integration

Response Trace

Every deliberation returns a full trace:

request_id: a71b3f2c...
formation: auto
source: auto        ← not "fallback" — dispatcher designed it
total_tokens: 12345
total_cost: $0.012
total_duration_ms: 15234

dispatch: V4 Flash (1,234ms, 800+420 tok)
workers:
  worker_rust: Claude Sonnet 4 (4,500ms, 300+1,200 tok)
  worker_go: Kimi K2.7 (8,200ms, 250+800 tok)
aggregator: V4 Flash (2,100ms, 3,000+500 tok)

Providers

Chimera uses LiteLLM under the hood. Supported providers:

Provider Direct API Via OpenRouter Models
DeepSeek ✅ ✅ v4-flash, v4-pro, r1
Anthropic — ✅ Sonnet 4, Opus 4.7/4.8, Haiku 4.5
OpenAI — ✅ GPT-5.5, GPT-5.1
xAI — ✅ Grok 4.20
Google — ✅ Gemini 3.5 Flash, 3.1 Pro, 2.5 Flash
Z.AI ✅ (direct) ✅ GLM-5.2
MoonshotAI — ✅ Kimi K2.7 Code, K2.6
MiniMax — ✅ M3
Meta — ✅ Llama 4 Maverick

Metadata

Release files for chimera-deliberation 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chimera-deliberation 0.2.4
File Size Uploaded
chimera_deliberation-0.2.4.tar.gz 2.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for chimera-deliberation 0.2.4
File Interpreter ABI Platform
chimera_deliberation-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 2.8 MB

Release files / chimera_deliberation-0.2.4.tar.gz

Download URL chimera_deliberation-0.2.4.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
b7bd5ec494c7026bb98c23d0d6cf66e9db015c6d3bc926a11804b45ca6f6ba5d
BLAKE2b-256 checksum
How to use checksums
dec686eddfc18bd1a700018893d4e4e28336ea1676cc6dabe0332692a2b4e4a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / chimera_deliberation-0.2.4-py3-none-any.whl

Download URL chimera_deliberation-0.2.4-py3-none-any.whl
Size 121.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a514fe887db91c031220895982146726d89ba3a4b69247e0bd45205843ba04e5
BLAKE2b-256 checksum
How to use checksums
d4555afd86674fd269416efde0e8ba234ab49ac612182bdc9c51c0ee2b7ea473
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.1

1 release file

0.2.0

2 release files

0.1.0

2 release 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