{"repo":"algorithmicsuperintelligence/optillm","free":true,"listed":false,"github":"https://github.com/algorithmicsuperintelligence/optillm","clone":"git clone https://github.com/algorithmicsuperintelligence/optillm.git","description":"Optimizing inference proxy for LLMs","language":"Python","stars":4242,"topics":["agent","agentic-ai","agentic-framework","agentic-workflow","agents","api-gateway","chain-of-thought","genai","large-language-models","llm","llm-inference","llmapi","mixture-of-experts","moa","monte-carlo-tree-search","openai","openai-api","optimization","prompt-engineering","proxy-server"],"license":"Apache-2.0","category":"llm_proxy","readme_excerpt":"# OptiLLM\n\n<p align=\"center\">\n  <img src=\"optillm-logo.png\" alt=\"OptiLLM Logo\" width=\"400\" />\n</p>\n\n<p align=\"center\">\n  <strong>🚀 2-10x accuracy improvements on reasoning tasks with zero training</strong>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/optillm/\"><img src=\"https://img.shields.io/pypi/v/optillm\" alt=\"PyPI version\"></a>\n  <a href=\"https://pepy.tech/projects/optillm\"><img src=\"https://static.pepy.tech/personalized-badge/optillm?period=monthly&units=INTERNATIONAL_SYSTEM&left_color=GREY&right_color=GREEN&left_text=downloads/month\" alt=\"PyPI Downloads\"></a>\n  <a href=\"https://github.com/algorithmicsuperintelligence/optillm/blob/main/LICENSE\"><img src=\"https://img.shields.io/github/license/algorithmicsuperintelligence/optillm\" alt=\"License\"></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://huggingface.co/spaces/codelion/optillm\">🤗 HuggingFace Space</a> •\n  <a href=\"https://colab.research.google.com/drive/1SpuUb8d9xAoTh32M-9wJsB50AOH54EaH?usp=sharing\">📓 Colab Demo</a> •\n  <a href=\"https://github.com/algorithmicsuperintelligence/optillm/discussions\">💬 Discussions</a>\n</p>\n\n---\n\n**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.\n\nIt 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.\n\n## ✨ Key Features\n\n- **🎯 Instant Improvements**: 2-10x better accuracy on math, coding, and logical reasoning\n- **🔌 Drop-in Replacement**: Works with any OpenAI-compatible API endpoint  \n- **🧠 20+ Optimization Techniques**: From simple best-of-N to advanced MCTS and planning\n- **📦 Zero Training Required**: Just proxy your existing API calls through OptiLLM\n- **⚡ Production Ready**: Used in production by companies and researchers worldwide\n- **🌍 Multi-Provider**: Supports OpenAI, Anthropic, Google, Cerebras, and 100+ models via LiteLLM\n\n## 🚀 Quick Start\n\nGet powerful reasoning improvements in 3 simple steps:\n\n```bash\n# 1. Install OptiLLM\npip install optillm\n\n# 2. Start the server\nexport OPENAI_API_KEY=\"your-key-here\"\noptillm\n\n# 3. Use with any OpenAI client - just change the model name!\n```\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(base_url=\"http://localhost:8000/v1\")\n\n# Add 'moa-' prefix for Mixture of Agents optimization\nresponse = client.chat.completions.create(\n    model=\"moa-gpt-4o-mini\",  # This gives you GPT-4o performance from GPT-4o-mini!\n    messages=[{\"role\": \"user\", \"content\": \"Solve: If 2x + 3 = 7, what is x?\"}]\n)\n```\n\n**Before OptiLLM**: \"x = 1\" ❌  \n**After OptiLLM**: \"Let me work through this step by step: 2x + 3 = 7, so 2x = 4, therefore x = 2\" ✅\n\n## 📊 Proven Results\n\nOptiLLM delivers measurable improvements across diverse benchmarks:\n\n| Technique | Base Model | Improvement | Benchmark |\n|-----------|------------|-------------|-----------|\n| **MARS** | Gemini 2.5 Flash Lite | **+30.0 points** | AIME 2025 (43.3→73.3) |\n| **CePO** | Llama 3.3 70B | **+18.6 points** | Math-L5 (51.0→69.6) |\n| **AutoThink** | DeepSeek-R1-1.5B | **+9.34 points** | GPQA-Diamond (21.72→31.06) |\n| **LongCePO** | Llama 3.3 70B | **+13.6 points** | InfiniteBench (58.0→71.6) |\n| **MOA** | GPT-4o-mini | **Matches GPT-4** | Arena-Hard-Auto |\n| **PlanSearch** | GPT-4o-mini | **+20% pass@5** | LiveCodeBench |\n\n*Full benchmark results [below](#sota-results-on-benchmarks-with-optillm)* ⬇️\n\n## 🏗️ Installation\n\n### Using pip\n\n```bash\npip install optillm\noptillm\n2024-10-22 07:45:05,612 - INFO - Loaded plugin: privacy\n2024-10-22 07:45:06,293 - INFO - Loaded plugin: memory\n2024-10-22 07:45:06,293 - INFO - Starting server with approach: auto\n```\n\n### Using docker\n\n```bash\ndocker pull ghcr.io/algorithmicsuperintelligence/optillm:latest\ndocker run -p 8000:8000 ghcr.io/algorithmicsuperintelligence/optillm:latest\n2024-10-22 07:45:05,612 - INFO - Loaded plugin: privacy\n2024-10-22 07:45:06,293 - INFO - Loaded plugin: memory\n2024-10-22 07:45:06,293 - INFO - Starting server with approach: auto\n```\n\n**Available Docker image variants:**\n\n- **Full image** (`latest`): Includes all dependencies for local inference and plugins\n- **Proxy-only** (`latest-proxy`): Lightweight image without local inference capabilities\n- **Offline** (`latest-offline`): Self-contained image with pre-downloaded models (spaCy) for fully offline operation\n\n```bash\n# Proxy-only (smallest)\ndocker pull ghcr.io/algorithmicsuperintelligence/optillm:latest-proxy\n\n# Offline (largest, includes pre-downloaded models)\ndocker pull ghcr.io/algorithmicsuperintelligence/optillm:latest-offline\n```\n\n### Install from source\n\nClone the repository with `git` and use `pip install` to setup the dependencies.\n\n```bash\ngit clone https://github.com/algorithmicsuperintelligence/optillm.git\ncd optillm\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n```\n\n## 🔒 SSL Configuration\n\nOptILLM supports SSL certificate verification configuration for working with self-signed certificates or corporate proxies.\n\n**Disable SSL verification (development only):**\n```bash\n# Command line\noptillm --no-ssl-verify\n\n# Environment variable\nexport OPTILLM_SSL_VERIFY=false\noptillm\n```\n\n**Use custom CA certificate:**\n```bash\n# Command line\noptillm --ssl-cert-path /path/to/ca-bundle.crt\n\n# Environment variable\nexport OPTILLM_SSL_CERT_PATH=/path/to/ca-bundle.crt\noptillm\n```\n\n⚠️ **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.\n\n## Implemented techniques\n\n| Approach                             | Slug               | Description                                                                                    |\n| ------------------------------------ | ------------------ | ---------------------------------------------------------------------------------------------- |\n| [MARS (Multi-Agent Reasoning System)](optillm/mars) | `mars`             | Multi-agent reasoning with diverse temperature exploration, cross-verification, and iterative improvement |\n| [Cerebras Planning and Optimization](optillm/cepo)   | `cepo`             | Combines Best of N, Chain-of-Thought, Self-Reflection, Self-Improvement, and various prompting techniques |\n| CoT with Reflection                  | `cot_reflection`   | Implements chain-of-thought reasoning with \\<thinking\\>, \\<reflection> and \\<output> sections |\n| PlanSearch                           | `plansearch`       | Implements a search algorithm over candidate plans for solving a problem in natural language   |\n| ReRead                               | `re2`              | Implements rereading to improve reasoning by processing queries twice                          |\n| Self-Consistency                     | `self_consistency` | Implements an advanced self-consistency method                                                 |\n| Z3 Solver                            | `z3`               | Utilizes the Z3 theorem prover for logical reasoning                                           |\n| R* Algorithm                         | `rstar`            | Implements the R* algorithm for problem-solving                                                |\n| LEAP                                 | `leap`             | Learns task-specific principles from few shot examples                                         |\n| Round Trip Optimization              | `rto`              | Optimizes responses through a round-trip process                                               |\n| Best of N Sampling                   | `bon`              | Generates multiple responses and selects the best one                                          |\n| Mixture of Agents                    | `moa`              | Combines responses from multiple critiques                                                     |\n| Monte Carlo Tree Search              | `mcts`             | Uses MCTS for decision-making in chat responses                                                |\n| PV Game                              | `pvg`              | Applies a prover-verifier game approach at inference time                                      |\n| [Deep Confidence](optillm/deepconf) | N/A for proxy | Implements confidence-guided reasoning with multiple intensity levels for enhanced accuracy |\n| CoT Decoding                         |  N/A for proxy     | Implements chain-of-thought decoding to elicit reasoning without explicit prompting            |\n| Entropy Decoding                     |  N/A for proxy     | Implements adaptive sampling based on the uncertainty of tokens during generation              |\n| Thinkdeeper                          |  N/A for proxy     | Implements the `reasoning_effort` param from OpenAI for reasoning models like DeepSeek R1      |\n| [AutoThink](optillm/autothink)       |  N/A for proxy     | Combines query complexity classification with steering vectors to enhance reasoning            |\n\n## Implemented plugins\n\n| Plugin                  | Slug               | Description                                                                                    |\n| ----------------------- | ------------------ | ---------------------------------------------------------------------------------------------- |\n| [System Prompt Learning](optillm/plugins/spl)  | `spl`              | Implements what [Andrej Karpathy called the third paradigm](https://x.com/karpathy/status/1921368644069765486) for LLM learning, this enables the model to acquire program solving knowledge and strategies |\n| [Deep Think](optillm/plugins/deepthink)              | `deepthink`        | Implements a Gemini-like Deep Think approach using inference time scaling for reasoning LLMs |\n| [Lo","default_branch":"main","files":228,"tree":[".dockerignore",".github/workflows/claude.yml",".github/workflows/publish-docker-full-amd64.yml",".github/workflows/publish-docker-full-arm64.yml",".github/workflows/publish-docker-manifest.yml",".github/workflows/publish-docker-offline-amd64.yml",".github/workflows/publish-docker-offline-arm64.yml",".github/workflows/publish-docker-proxy-amd64.yml",".github/workflows/publish-docker-proxy-arm64.yml",".github/workflows/publish.yml",".github/workflows/security-scan.yml",".github/workflows/test.yml",".gitignore","CLAUDE.md","Dockerfile","Dockerfile.offline","Dockerfile.proxy_only","LICENSE","MANIFEST.in","README.md","SSL_CONFIGURATION.md","docker-compose.yaml","moa-patchwork-results.png","moa-results.png","optillm-logo.png","optillm-sequence-diagram.png","optillm.py","optillm/__init__.py","optillm/autothink/README.md","optillm/autothink/__init__.py","optillm/autothink/autothink.py","optillm/autothink/classifier.py","optillm/autothink/example.py","optillm/autothink/processor.py","optillm/autothink/steering.py","optillm/batching.py","optillm/bon.py","optillm/cepo/README.md","optillm/cepo/__init__.py","optillm/cepo/cepo.py","optillm/cepo/configs/cepo_config.yaml","optillm/cepo/configs/cepo_config_gptoss.yaml","optillm/cepo/configs/cepo_config_qwen3.yaml","optillm/conversation_logger.py","optillm/cot_decoding.py","optillm/cot_reflection.py","optillm/deepconf/README.md","optillm/deepconf/__init__.py","optillm/deepconf/confidence.py","optillm/deepconf/deepconf.py","optillm/deepconf/processor.py","optillm/entropy_decoding.py","optillm/inference.py","optillm/leap.py","optillm/litellm_wrapper.py","optillm/mars/README.md","optillm/mars/__init__.py","optillm/mars/agent.py","optillm/mars/aggregator.py","optillm/mars/answer_extraction.py","optillm/mars/mars.py","optillm/mars/prompts.py","optillm/mars/strategy_network.py","optillm/mars/verifier.py","optillm/mars/workspace.py","optillm/mcts.py","optillm/moa.py","optillm/plansearch.py","optillm/plugins/coc_plugin.py","optillm/plugins/compact_plugin.py","optillm/plugins/deep_research/README.md","optillm/plugins/deep_research/__init__.py","optillm/plugins/deep_research/research_engine.py","optillm/plugins/deep_research/sample_reports/01_evaluate_the_potential_consequences_of_tiktok_bans.md","optillm/plugins/deep_research/sample_reports/02_chart_the_developing_landscape_of_ai_agents_and_co.md","optillm/plugins/deep_research/sample_reports/03_analyze_the_dynamic_terrain_of_unbanked_market_acc.md","optillm/plugins/deep_research/sample_reports/04_examine_kkrs_tech_centric_transactions_and_their_a.md","optillm/plugins/deep_research/sample_reports/05_break_down_khosla_ventures_portfolio_into_cutting.md","optillm/plugins/deep_research/sample_reports/06_evaluate_the_commercial_rationale_for_participatin.md","optillm/plugins/deep_research/sample_reports/07_analyze_the_economic_and_investment_implications_o.md","optillm/plugins/deep_research/sample_reports/08_conduct_an_in_depth_exploration_of_the_role_activi.md","optillm/plugins/deep_research/sample_reports/09_analyze_how_robinhood_generates_revenue_and_how_it.md","optillm/plugins/deep_research/sample_reports/10_compose_a_comprehensive_and_insightful_investment.md","optillm/plugins/deep_research/sample_reports/11_conduct_an_in_depth_examination_of_the_pet_insuran.md","optillm/plugins/deep_research/sample_reports/12_examine_the_business_strategies_and_market_demand.md","optillm/plugins/deep_research/sample_reports/13_examine_the_progression_of_decentralized_finance_d.md","optillm/plugins/deep_research/sample_reports/14_investigate_potential_investment_opportunities_in.md","optillm/plugins/deep_research/sample_reports/15_delve_into_the_intricacies_of_remote_workforce_str.md","optillm/plugins/deep_research/sample_reports/16_conduct_a_thorough_assessment_of_circle_stablecoin.md","optillm/plugins/deep_research/sample_reports/17_present_a_sector_overview_on_digital_identity_solu.md","optillm/plugins/deep_research/sample_reports/18_conduct_an_in_depth_exploration_of_how_emerging_te.md","optillm/plugins/deep_research/sample_reports/19_explore_the_impact_of_emerging_technologies_on_enh.md","optillm/plugins/deep_research/sample_reports/20_prepare_a_detailed_strategic_report_on_smart_stadi.md","optillm/plugins/deep_research/sample_reports/21_assess_the_financial_viability_and_expected_timeli.md","optillm/plugins/deep_research/sample_reports/22_develop_a_comprehensive_financial_model_for_a_mort.md","optillm/plugins/deep_research/sample_reports/23_develop_a_detailed_and_comprehensive_three_stateme.md","optillm/plugins/deep_research/sample_reports/24_conduct_an_in_depth_exploration_into_the_competiti.md","optillm/plugins/deep_research/sample_reports/25_conduct_a_detailed_analysis_of_palantir_technologi.md","optillm/plugins/deep_research/sample_reports/26_examine_the_strategic_consequences_of_obtaining_b.md","optillm/plugins/deep_research/sample_reports/27_evaluate_the_investment_potential_for_startups_foc.md","optillm/plugins/deep_research/sample_reports/28_conduct_a_thorough_evaluation_of_performance_trend.md","optillm/plugins/deep_research/sample_reports/29_analyze_emerging_companies_designing_solid_state_a.md","optillm/plugins/deep_research/sample_reports/30_explore_the_current_startups_leveraging_large_lang.md","optillm/plugins/deep_research/sample_reports/31_prepare_a_comprehensive_and_detailed_industry_repo.md","optillm/plugins/deep_research/sample_reports/32_examine_sea_ltds_online_retail_and_gaming_division.md","optillm/plugins/deep_research/sample_reports/33_undertake_an_in_depth_examination_of_the_adoption.md","optillm/plugins/deep_research/sample_reports/34_analyze_worldwide_lithium_deposits_and_explore_fin.md","optillm/plugins/deep_research/sample_reports/35_outline_the_framework_and_objectives_for_establish.md","optillm/plugins/deep_research/sample_reports/36_identify_and_examine_startups_that_facilitate_carb.md","optillm/plugins/deep_research/sample_reports/37_analyze_the_competitive_environment_of_saas_soluti.md","optillm/plugins/deep_research/sample_reports/38_create_a_comprehensive_strategy_outline_for_a_larg.md","optillm/plugins/deep_research/sample_reports/39_evaluate_accels_initial_stage_strategy_and_interna.md","optillm/plugins/deep_research/sample_reports/40_evaluate_the_regulatory_and_fiscal_context_influen.md","optillm/plugins/deep_research/sample_reports/41_conduct_a_comprehensive_study_on_the_regulatory_an.md","optillm/plugins/deep_research/sample_reports/42_prepare_a_comprehensive_boardroom_level_overview_o.md","optillm/plugins/deep_research/sample_reports/43_conduct_a_thorough_evaluation_of_the_current_state.md","optillm/plugins/deep_research/sample_reports/44_evaluate_the_strategic_consequences_of_american_ex.md","optillm/plugins/deep_research/sample_reports/45_conduct_a_thorough_exploration_into_the_policy_and.md","optillm/plugins/deep_research/sample_reports/46_conduct_a_comprehensive_analysis_on_how_emerging_t.md","optillm/plugins/deep_research/sample_reports/47_conduct_a_thorough_and_comprehensive_investigation.md","optillm/plugins/deep_research/sample_reports/README.md","optillm/plugins/deep_research/session_state.py","optillm/plugins/deep_research_plugin.py","optillm/plugins/deepthink/README.md","optillm/plugins/deepthink/__init__.py","optillm/plugins/deepthink/reasoning_modules.py","optillm/plugins/deepthink/self_discover.py","optillm/plugins/deepthink/uncertainty_cot.py","optillm/plugins/deepthink_plugin.py","optillm/plugins/executecode_plugin.py","optillm/plugins/genselect_plugin.py","optillm/plugins/json_plugin.py","optillm/plugins/longcepo/README.md","optillm/plugins/longcepo/__init__.py","optillm/plugins/longcepo/chunking.py","optillm/plugins/longcepo/config.py","optillm/plugins/longcepo/main.py","optillm/plugins/longcepo/mapreduce.py","optillm/plugins/longcepo/prompts.py","optillm/plugins/longcepo/utils.py","optillm/plugins/longcepo_plugin.py","optillm/plugins/majority_voting_plugin.py","optillm/plugins/mcp_plugin.py","optillm/plugins/memory_plugin.py","optillm/plugins/privacy_plugin.py","optillm/plugins/proxy/README.md","optillm/plugins/proxy/__init__.py","optillm/plugins/proxy/approach_handler.py","optillm/plugins/proxy/client.py","optillm/plugins/proxy/config.py","optillm/plugins/proxy/example_config.yaml","optillm/plugins/proxy/health.py","optillm/plugins/proxy/routing.py","optillm/plugins/proxy_plugin.py","optillm/plugins/readurls_plugin.py","optillm/plugins/router_plugin.py","optillm/plugins/spl/README.md","optillm/plugins/spl/__init__.py","optillm/plugins/spl/config.py","optillm/plugins/spl/data/metrics.json","optillm/plugins/spl/data/strategies.json","optillm/plugins/spl/evaluation.py","optillm/plugins/spl/generation.py","optillm/plugins/spl/learning-workflow.svg","optillm/plugins/spl/main.py","optillm/plugins/spl/performance-comparison.svg","optillm/plugins/spl/prompts.py","optillm/plugins/spl/strategy.py","optillm/plugins/spl/utils.py","optillm/plugins/spl_plugin.py","optillm/plugins/web_search_plugin.py","optillm/pvg.py","optillm/reread.py","optillm/rstar.py","optillm/rto.py","optillm/self_consistency.py","optillm/server.py","optillm/thinkdeeper.py","optillm/thinkdeeper_mlx.py","optillm/utils/__init__.py","optillm/utils/answer_extraction.py","optillm/z3_solver.py","pyproject.toml","requirements.txt","requirements_proxy_only.txt","scripts/eval_aime_benchmark.py","scripts/eval_arena_hard_auto_rtc.py","scripts/eval_frames_benchmark.py","scripts/eval_imo25_benchmark.py","scripts/eval_imobench_answer.py","scripts/eval_imobench_proof.py","scripts/eval_math500_benchmark.py","scripts/eval_optillmbench.py","scripts/eval_simpleqa_benchmark.py","scripts/gen_optillm_dataset.py","scripts/gen_optillm_ground_truth_dataset.py","scripts/gen_optillmbench.py","scripts/imo25_reference.py","scripts/requirements.txt","scripts/train_optillm_classifier.py","test_results.png","tests/README.md","tests/__init__.py","tests/requirements.txt","tests/run_tests.sh","tests/test.py","tests/test_api_compatibility.py","tests/test_approaches.py","tests/test_batching.py","tests/test_cases.json","tests/test_ci_quick.py","tests/test_compact_plugin.py","tests/test_conversation_logger.py","tests/test_conversation_logging_approaches.py","tests/test_conversation_logging_server.py","tests/test_deepconf.py","tests/test_json_plugin.py","tests/test_mars_imo25.py","tests/test_mars_parallel.py","tests/test_mcp_plugin.py","tests/test_n_parameter.py","tests/test_plugins.py","tests/test_privacy_plugin_performance.py","tests/test_reasoning_integration.py","tests/test_reasoning_simple.py","tests/test_reasoning_tokens.py","tests/test_ssl_config.py","tests/test_utils.py"],"storefront":"/r/algorithmicsuperintelligence","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/algorithmicsuperintelligence/optillm/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}