Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.0 KB
Raw Blame
"""
OmniRoute Quickstart — Python (requests library)
================================================
Run:  pip install requests  (if not already installed)
      python python_requests.py
"""

import requests

# Your local OmniRoute server — started with: npx omniroute
API_URL = "http://localhost:20128/v1/chat/completions"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer dummy-key",  # Any string works for free/keyless providers
}

data = {
    "model": "auto",  # Zero-config routing, works out of the box — no sign-up needed
    "stream": False,
    "messages": [
        {"role": "user", "content": "Hello! What can you do?"}
    ],
}

response = requests.post(API_URL, headers=headers, json=data)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])

# Fresh install, zero credentials — `auto` already works:
# curl http://localhost:20128/v1/chat/completions \
#   -H "Content-Type: application/json" \
#   -d '{"model":"auto","messages":[{"role":"user","content":"Hello!"}]}'