diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 1173b0ef..69bc108f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -53,6 +53,23 @@ jobs:
python tests/test_ci_quick.py
python -m pytest tests/test_plugins.py -v --tb=short || python tests/test_plugins.py
python -m pytest tests/test_proxy_plugin.py -v --tb=short
+ python -m pytest tests/test_streaming_hints.py -v --tb=short
+ python -m pytest tests/test_plugin_gating.py -v --tb=short
+ python -m pytest tests/test_max_completion_tokens.py -v --tb=short
+ python -m pytest tests/test_bon_candidate_filtering.py -v --tb=short
+ python -m pytest tests/test_compact_plugin.py -v --tb=short
+ python -m pytest tests/test_completions_endpoint.py -v --tb=short
+ python -m pytest tests/test_entropy_decoding_sampling.py -v --tb=short
+ python -m pytest tests/test_mars_agent_routing.py -v --tb=short
+ python -m pytest tests/test_mars_aggregation_sampling.py -v --tb=short
+ python -m pytest tests/test_mars_imo25.py -v --tb=short
+ python -m pytest tests/test_mars_workspace_verification.py -v --tb=short
+ python -m pytest tests/test_mcts_selection.py -v --tb=short
+ python -m pytest tests/test_privacy_plugin_performance.py -v --tb=short
+ python -m pytest tests/test_readurls_ssrf.py -v --tb=short
+ python -m pytest tests/test_rstar_backpropagation.py -v --tb=short
+ python -m pytest tests/test_rstar_numeric_answers.py -v --tb=short
+ python -m pytest tests/test_z3_solver_guard.py -v --tb=short
python tests/test_approaches.py
python tests/test_reasoning_simple.py
python tests/test_batching.py
@@ -125,7 +142,7 @@ jobs:
OPTILLM_API_KEY=optillm python tests/test_reasoning_integration.py
OPTILLM_API_KEY=optillm python tests/test_json_plugin.py
OPTILLM_API_KEY=optillm python tests/test_n_parameter.py
- OPTILLM_API_KEY=optillm python -m pytest tests/test_api_compatibility.py -v --tb=short || echo "API compatibility tests require pytest"
+ OPTILLM_API_KEY=optillm python -m pytest tests/test_api_compatibility.py -v --tb=short
OPTILLM_API_KEY=optillm python tests/test.py --approaches none --single-test "Simple Math Problem" || echo "Main test completed"
# Run SSL config tests (no server needed but requires proper env setup)
@@ -256,7 +273,6 @@ jobs:
mcp-tests:
runs-on: ubuntu-latest
needs: unit-tests
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Only run on main branch pushes (secrets available)
strategy:
matrix:
python-version: ['3.12']
@@ -296,5 +312,6 @@ jobs:
echo "MCP tests completed successfully!"
env:
OPTILLM_API_KEY: optillm
+ # Not available on fork PRs, where the one test that needs it skips itself
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
\ No newline at end of file
diff --git a/README.md b/README.md
index 40c4f20e..e6c2a6a5 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
# OptiLLM
-
+
- ๐ 2-10x accuracy improvements on reasoning tasks with zero training
+ 2-10x accuracy improvements on reasoning tasks with zero training
@@ -15,110 +15,85 @@
- ๐ค HuggingFace Space โข
- ๐ Colab Demo โข
- ๐ฌ Discussions
+ HuggingFace Space |
+ Colab Demo |
+ Discussions
----
+**OptiLLM** is an OpenAI API-compatible optimizing inference proxy that implements 20+ state-of-the-art techniques to dramatically improve LLM accuracy and performance on reasoning tasks, without requiring any model training or fine-tuning.
-**OptiLLM** is an OpenAI API-compatible optimizing inference proxy that implements 20+ state-of-the-art techniques to dramatically improve LLM accuracy and performance on reasoning tasks - without requiring any model training or fine-tuning.
+It is possible to beat the frontier models using these techniques across diverse tasks by doing additional compute at inference time. A good example of how to combine such techniques is the [CePO approach](optillm/cepo) from Cerebras.
-It is possible to beat the frontier models using these techniques across diverse tasks by doing additional compute at inference time. A good example of how to combine such techniques together is the [CePO approach](optillm/cepo) from Cerebras.
+## Key features
-## โจ Key Features
+- **Instant improvements**: 2-10x better accuracy on math, coding, and logical reasoning
+- **Drop-in replacement**: Works with any OpenAI-compatible API endpoint
+- **20+ optimization techniques**: From simple best-of-N to advanced MCTS and planning
+- **Zero training required**: Just proxy your existing API calls through OptiLLM
+- **Production ready**: Used in production by companies and researchers worldwide
+- **Multi-provider**: Supports OpenAI, Anthropic, Google, Cerebras, and 100+ models via LiteLLM
-- **๐ฏ Instant Improvements**: 2-10x better accuracy on math, coding, and logical reasoning
-- **๐ Drop-in Replacement**: Works with any OpenAI-compatible API endpoint
-- **๐ง 20+ Optimization Techniques**: From simple best-of-N to advanced MCTS and planning
-- **๐ฆ Zero Training Required**: Just proxy your existing API calls through OptiLLM
-- **โก Production Ready**: Used in production by companies and researchers worldwide
-- **๐ Multi-Provider**: Supports OpenAI, Anthropic, Google, Cerebras, and 100+ models via LiteLLM
-
-## ๐ Quick Start
-
-Get powerful reasoning improvements in 3 simple steps:
+## Quick start
```bash
-# 1. Install OptiLLM
pip install optillm
-
-# 2. Start the server
export OPENAI_API_KEY="your-key-here"
optillm
-
-# 3. Use with any OpenAI client - just change the model name!
```
+Point any OpenAI client at the proxy and prefix the model name with a technique:
+
```python
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1")
-# Add 'moa-' prefix for Mixture of Agents optimization
response = client.chat.completions.create(
- model="moa-gpt-4o-mini", # This gives you GPT-4o performance from GPT-4o-mini!
- messages=[{"role": "user", "content": "Solve: If 2x + 3 = 7, what is x?"}]
+ model="moa-gpt-4o-mini", # This gives you GPT-4o performance from GPT-4o-mini
+ messages=[{"role": "user", "content": "Solve: If 2x + 3 = 7, what is x?"}],
)
```
-**Before OptiLLM**: "x = 1" โ
-**After OptiLLM**: "Let me work through this step by step: 2x + 3 = 7, so 2x = 4, therefore x = 2" โ
+**Before OptiLLM**: "x = 1"
+**After OptiLLM**: "Let me work through this step by step: 2x + 3 = 7, so 2x = 4, therefore x = 2"
-## ๐ Proven Results
+## Results
-OptiLLM delivers measurable improvements across diverse benchmarks:
-
-| Technique | Base Model | Improvement | Benchmark |
+| Technique | Base model | Improvement | Benchmark |
|-----------|------------|-------------|-----------|
-| **MARS** | Gemini 2.5 Flash Lite | **+30.0 points** | AIME 2025 (43.3โ73.3) |
-| **CePO** | Llama 3.3 70B | **+18.6 points** | Math-L5 (51.0โ69.6) |
-| **AutoThink** | DeepSeek-R1-1.5B | **+9.34 points** | GPQA-Diamond (21.72โ31.06) |
-| **LongCePO** | Llama 3.3 70B | **+13.6 points** | InfiniteBench (58.0โ71.6) |
-| **MOA** | GPT-4o-mini | **Matches GPT-4** | Arena-Hard-Auto |
-| **PlanSearch** | GPT-4o-mini | **+20% pass@5** | LiveCodeBench |
+| MARS | Gemini 2.5 Flash Lite | +30.0 points | AIME 2025 (43.3 to 73.3) |
+| CePO | Llama 3.3 70B | +18.6 points | Math-L5 (51.0 to 69.6) |
+| LongCePO | Llama 3.3 70B | +13.6 points | InfiniteBench (58.0 to 71.6) |
+| AutoThink | DeepSeek-R1-1.5B | +9.34 points | GPQA-Diamond (21.72 to 31.06) |
+| PlanSearch | GPT-4o-mini | +20% pass@5 | LiveCodeBench |
+| MOA | GPT-4o-mini | Matches GPT-4 | Arena-Hard-Auto |
-*Full benchmark results [below](#sota-results-on-benchmarks-with-optillm)* โฌ๏ธ
+See [benchmark results](#benchmark-results) for the full tables.
-## ๐๏ธ Installation
+## Installation
-### Using pip
+**pip**
```bash
pip install optillm
-optillm
-2024-10-22 07:45:05,612 - INFO - Loaded plugin: privacy
-2024-10-22 07:45:06,293 - INFO - Loaded plugin: memory
-2024-10-22 07:45:06,293 - INFO - Starting server with approach: auto
```
-### Using docker
+**Docker**
```bash
docker pull ghcr.io/algorithmicsuperintelligence/optillm:latest
docker run -p 8000:8000 ghcr.io/algorithmicsuperintelligence/optillm:latest
-2024-10-22 07:45:05,612 - INFO - Loaded plugin: privacy
-2024-10-22 07:45:06,293 - INFO - Loaded plugin: memory
-2024-10-22 07:45:06,293 - INFO - Starting server with approach: auto
```
-**Available Docker image variants:**
+| Image tag | Contents |
+|-----------|----------|
+| `latest` | All dependencies for local inference and plugins |
+| `latest-proxy` | Lightweight image without local inference |
+| `latest-offline` | Self-contained image with pre-downloaded models (spaCy) for fully offline operation |
-- **Full image** (`latest`): Includes all dependencies for local inference and plugins
-- **Proxy-only** (`latest-proxy`): Lightweight image without local inference capabilities
-- **Offline** (`latest-offline`): Self-contained image with pre-downloaded models (spaCy) for fully offline operation
+To build and run from the repository, set your keys in `docker-compose.yaml` or a `.env` file and run `docker compose up -d`.
-```bash
-# Proxy-only (smallest)
-docker pull ghcr.io/algorithmicsuperintelligence/optillm:latest-proxy
-
-# Offline (largest, includes pre-downloaded models)
-docker pull ghcr.io/algorithmicsuperintelligence/optillm:latest-offline
-```
-
-### Install from source
-
-Clone the repository with `git` and use `pip install` to setup the dependencies.
+**From source**
```bash
git clone https://github.com/algorithmicsuperintelligence/optillm.git
@@ -126,347 +101,187 @@ cd optillm
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
-```
-
-## ๐ SSL Configuration
-
-OptILLM supports SSL certificate verification configuration for working with self-signed certificates or corporate proxies.
-
-**Disable SSL verification (development only):**
-```bash
-# Command line
-optillm --no-ssl-verify
-
-# Environment variable
-export OPTILLM_SSL_VERIFY=false
-optillm
-```
-
-**Use custom CA certificate:**
-```bash
-# Command line
-optillm --ssl-cert-path /path/to/ca-bundle.crt
-
-# Environment variable
-export OPTILLM_SSL_CERT_PATH=/path/to/ca-bundle.crt
-optillm
-```
-
-โ ๏ธ **Security Note**: Disabling SSL verification is insecure and should only be used in development. For production environments with custom CAs, use `--ssl-cert-path` instead. See [SSL_CONFIGURATION.md](SSL_CONFIGURATION.md) for details.
-
-## ๐ URL Fetch Security (readurls plugin)
-
-The `readurls` plugin fetches URLs found in prompts and blocks requests to non-public destinations (private, loopback, link-local, reserved addresses such as the cloud metadata IP `169.254.169.254`) to prevent SSRF. Every redirect hop is re-validated and unresolvable hosts are rejected.
-
-If your deployment intentionally needs to read internal documentation pages, you can explicitly opt out:
-
-```bash
-# Command line
-optillm --readurls-allow-internal
-
-# Environment variable
-export OPTILLM_READURLS_ALLOW_INTERNAL=true
-optillm
-```
-
-โ ๏ธ **Security Note**: Only enable this on trusted networks where internal URL fetching is actually required.
-
-**Known limitation (DNS rebinding)**: the guard validates DNS resolution before each request, but the underlying HTTP client performs a second resolution when it opens the connection, so a domain under attacker control could rebind to an internal address between the two lookups. For high-security deployments, additionally restrict the network egress of the optillm process (firewall or service-mesh policy) instead of relying on this check alone.
-
-## Implemented techniques
-
-| Approach | Slug | Description |
-| ------------------------------------ | ------------------ | ---------------------------------------------------------------------------------------------- |
-| [MARS (Multi-Agent Reasoning System)](optillm/mars) | `mars` | Multi-agent reasoning with diverse temperature exploration, cross-verification, and iterative improvement |
-| [Cerebras Planning and Optimization](optillm/cepo) | `cepo` | Combines Best of N, Chain-of-Thought, Self-Reflection, Self-Improvement, and various prompting techniques |
-| CoT with Reflection | `cot_reflection` | Implements chain-of-thought reasoning with \, \ and \