█

AI/TLDR

Buy me a coffee
Buy me a coffee

optillm

An OpenAI-compatible proxy that boosts reasoning accuracy at inference time

Gateways & RoutingOpen source
Language
Python
$pip install optillm
IN SHORT

What is optillm?

optillm is an OpenAI-compatible proxy that boosts reasoning accuracy at inference time. It sits in the Gateways & Routing category of the Evaluation & Production Ops tools and is open-source, written in Python. To get started: install.

Overview

OptiLLM is an OpenAI API-compatible inference proxy that sits between your application and your language model. Instead of changing the model itself, it spends extra compute at request time, running techniques like Mixture of Agents, planning search, and multi-agent reasoning to improve answers on math, coding, and logic tasks.

It works as a drop-in replacement for any OpenAI-compatible endpoint. You point your existing OpenAI client at the local OptiLLM server and pick a technique by adding a prefix to the model name (for example 'moa-gpt-4o-mini'). Through LiteLLM it can route to OpenAI, Anthropic, Google, Cerebras, and many other models, so no fine-tuning or training is needed.

As an LLM gateway, OptiLLM fits teams that already call a chat-completions API and want better reasoning results without swapping models or retraining. You keep your client code and just route calls through the proxy.

What it does

  • OpenAI API-compatible: works as a drop-in proxy for any OpenAI-compatible client or endpoint
  • Over 20 inference-time optimization techniques, from best-of-N to MCTS, planning search, and multi-agent reasoning (MARS, CePO, MOA)
  • Pick a technique per request by adding a prefix to the model name (for example 'moa-' for Mixture of Agents)
  • Multi-provider routing via LiteLLM, covering OpenAI, Anthropic, Google, Cerebras, and many other models
  • No model training or fine-tuning required, the improvements come purely from extra compute at inference
  • SSL options for self-signed certificates and corporate proxies via --ssl-cert-path or OPTILLM_SSL_CERT_PATH

Getting started

Install OptiLLM, start the proxy server, then point any OpenAI client at it and choose a technique through the model name prefix.

Install

Install the package from PyPI. A Docker image is also available at ghcr.io/algorithmicsuperintelligence/optillm.

bashbash
pip install optillm

Start the server

Set your API key and run the optillm command. The server listens on port 8000 by default.

bashbash
export OPENAI_API_KEY="your-key-here"
optillm

Call it from an OpenAI client

Point the OpenAI client at the local server and add a technique prefix (such as 'moa-') to the model name.

pythonpython
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1")

response = client.chat.completions.create(
    model="moa-gpt-4o-mini",
    messages=[{"role": "user", "content": "Solve: If 2x + 3 = 7, what is x?"}]
)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Improving accuracy on math, coding, or logic prompts without switching to a larger model or fine-tuning
  • Adding inference-time reasoning techniques to an existing app that already uses an OpenAI-compatible client
  • Routing requests across OpenAI, Anthropic, Google, and other providers through one proxy via LiteLLM
  • Running self-hosted via Docker behind a corporate proxy with custom CA certificates

How optillm compares

optillm alongside other open-source gateways & routing tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
OmniRoute★ 91.4kA local-first AI gateway that fronts hundreds of model providers with one OpenAI-compatible endpoint, quota-aware auto-fallback, many routing strategies and prompt compression.
Free Claude Code★ 74.7kA local proxy that points Claude Code, Codex, Pi, OpenCode, Cline and other agent CLIs at 50 free, paid, subscription or local model providers, with automatic failover and an admin UI.
LiteLLM★ 64.2kA Python SDK and proxy server that gives one OpenAI-compatible API to 100+ LLM providers, with cost tracking, budgets, fallbacks, rate limiting, and an admin UI.
Kong Gateway★ 44.4kA Lua/NGINX API gateway whose AI Gateway plugins put one universal endpoint in front of OpenAI, Anthropic, Gemini, Bedrock and other providers, with semantic routing, caching and MCP traffic governance.
magpie★ 43.7kMenu bar app and local gateway that lets Claude Code, Codex, Gemini CLI and dozens of other coding agents run on any provider's model, with routing groups that fail over across accounts when a quota runs out.
9Router★ 33kLocal OpenAI-compatible router for coding CLIs that tracks per-provider quota, falls back from subscription to cheap to free models, and compresses tool results to cut tokens.
Experiential★ 20.1kAn open-source gateway that puts hosted, BYOK, local and custom models behind one OpenAI-compatible API, with per-identity model and spend limits and routers fitted from your own traces.
optillm★ 4.3kAn OpenAI-compatible proxy that boosts reasoning accuracy at inference time