How algorithmicsuperintelligence/optillm works
OptiLLM is an OpenAI-compatible inference proxy: a client submits chat requests, the server selects an optimization approach, that approach may make one or more model calls, and the server returns an OpenAI-shaped response. Techniques span planning, voting, multi-agent reasoning, prompt learning, and long-context research; local inference and multi-provider routing are alternative serving paths. The graph emphasizes documented request routing and explicit source-index references. Several plugin internals are unsampled, so their internal links are omitted.
Main entry points: server.py API server · mars.py MARS orchestration · bon.py Best of N · cepo.py CePO
Components 24
Request handling
- API server
optillm/server.py - Approach router
optillm/plugins/router_plugin.py
Reasoning techniques
- Best of N
optillm/bon.py - CePO
optillm/cepo/cepo.py - MARS orchestration
optillm/mars/mars.py - MARS agents
optillm/mars/agent.py - MARS workspace
optillm/mars/workspace.py - Mixture of agents
optillm/moa.py - MCTS
optillm/mcts.py - PlanSearch
optillm/plansearch.py - PVG
optillm/pvg.py - rStar
optillm/rstar.py - RTO
optillm/rto.py - Self consistency
optillm/self_consistency.py - Z3 solver
optillm/z3_solver.py
Specialized plugins
- LongCePO
optillm/plugins/longcepo/main.py - Prompt learning
optillm/plugins/spl/main.py - Deep research
optillm/plugins/deep_research/research_engine.py - Web search
optillm/plugins/web_search_plugin.py
Inference and providers
- Local inference
optillm/inference.py - Provider proxy
optillm/plugins/proxy/client.py
Logging and state
- Conversation logger
optillm/conversation_logger.py
Other components
- OpenAI client
- LLM provider
Connections 27
- OpenAI client → API server: sends request
README.md - API server → Approach router: selects approach
optillm/server.py - API server → Best of N: dispatches to
optillm/server.py - API server → CePO: dispatches to
optillm/server.py - API server → MARS orchestration: dispatches to
optillm/server.py - API server → Mixture of agents: dispatches to
optillm/server.py - API server → MCTS: dispatches to
optillm/server.py - API server → PlanSearch: dispatches to
optillm/server.py - API server → PVG: dispatches to
optillm/server.py - API server → rStar: dispatches to
optillm/server.py - API server → RTO: dispatches to
optillm/server.py - API server → Self consistency: dispatches to
optillm/server.py - API server → Z3 solver: dispatches to
optillm/server.py - API server → Local inference: serves locally
optillm/inference.py - API server → Provider proxy: uses provider proxy
optillm/server.py - Provider proxy → LLM provider: forwards requests
README.md - API server → LongCePO: dispatches to
- API server → Prompt learning: dispatches to
- API server → Deep research: dispatches to
- Deep research → Web search: searches sources
optillm/plugins/deep_research/research_engine.py - MARS orchestration → MARS agents: runs agents
optillm/mars/mars.py - MARS orchestration → MARS workspace: uses workspace
optillm/mars/mars.py - API server → Conversation logger: records requests
optillm/server.py - Best of N → LLM provider: generates candidates
- CePO → LLM provider: requests completions
optillm/cepo/cepo.py - PlanSearch → LLM provider: requests completions
optillm/plansearch.py - OpenAI client → API server: receives response
README.md