### Setup OrcaRouter-Lite Environment Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/DEMO.md Configure API keys for LLM providers and start the Docker Compose services. This prepares the environment for the failover demo. ```bash cd OrcaRouter-Lite cp .env.example .env # Configure BOTH providers so failover has somewhere to go. echo 'OPENAI_API_API_KEY=sk-...' >> .env echo 'ANTHROPIC_API_KEY=sk-ant-...' >> .env # Optional: GOOGLE_API_KEY, GROQ_API_KEY for more failover variety docker compose up -d docker compose logs api 2>&1 | grep 'sk-orca-' # → copy the printed sk-orca-* key ``` -------------------------------- ### Self-hosted OrcaRouter Lite Setup Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.pt.md Clone the repository, set up your environment variables with at least one API key (e.g., OPENAI_API_KEY or ORCAROUTER_API_KEY), and start the service using Docker Compose. The base URL will be `http://localhost:8000/v1` and a key like `sk-orca-*` will be printed on startup. ```bash git clone https://github.com/Continuum-AI-Corp/OrcaRouter-Lite.git cd OrcaRouter-Lite cp .env.example .env # adicione pelo menos uma: OPENAI_API_KEY=sk-... # (ou ORCAROUTER_API_KEY=...) docker compose up # logs: ✓ orcarouter-lite ready. API key: sk-orca-abc123... ``` -------------------------------- ### Clone and Run OrcaRouter Lite Locally Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.hi.md This snippet shows how to clone the OrcaRouter Lite repository, set up the environment, and start the service using Docker. Ensure you have Docker installed and configured. ```bash git clone https://github.com/Continuum-AI-Corp/OrcaRouter-Lite.git cd OrcaRouter-Lite cp .env.example .env # कम से कम एक जोड़ें: OPENAI_API_KEY=sk-... (या ORCAROUTER_API_KEY=...) docker compose up # logs: ✓ orcarouter-lite ready. API key: sk-orca-abc123... ``` -------------------------------- ### Call OrcaRouter Lite with Python SDK Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.hi.md Demonstrates how to use the OpenAI Python SDK to interact with OrcaRouter Lite. Replace the base URL and API key with your specific setup. This example uses the 'auto' model to select the cheapest capable model. ```python from openai import OpenAI client = OpenAI( base_url="http://localhost:8000/v1", api_key="sk-orca-abc123...", ) r = client.chat.completions.create( model="auto", # या "gpt-4o-mini", "claude-3-5-sonnet-latest", ... messages=[{"role": "user", "content": "Hello!"}], ) print(r.choices[0].message.content) ``` -------------------------------- ### Start Failover Demo Loop Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/DEMO.md Initiates the demo script in a loop, sending requests to the LLM API. Ensure the ORCA_API_KEY is set. ```bash export ORCA_API_KEY="sk-orca-..." ./scripts/demo.sh ``` -------------------------------- ### Python Example: Use 'auto' model Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/design/index.html Example demonstrating how to use the 'auto' model with the OpenAI SDK. The router will automatically select the cheapest capable model. ```python from openai import OpenAI client = OpenAI( base_url="http://localhost:8000/v1", api_key="sk-orca-YOUR-KEY" ) completion = client.chat.completions.create( model="auto", messages=[{"role": "user", "content": "Hello world"}] ) ``` -------------------------------- ### Install and Run Tests Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.fr.md Installs the project in development mode and runs the test suite using pytest. This is the primary method for verifying code correctness. ```bash pip install -e ".[dev]" PYTHONPATH=. pytest -v # 127 passed ``` -------------------------------- ### Clone and Run OrcaRouter Lite Locally Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.es.md Clone the repository, set up your environment variables with API keys, and start the service using Docker Compose. This method is for self-hosting with your own provider keys. ```bash git clone https://github.com/Continuum-AI-Corp/OrcaRouter-Lite.git cd OrcaRouter-Lite cp .env.example .env # add at least one: OPENAI_API_KEY=sk-... # or ORCAROUTER_API_KEY=... docker compose up # logs: ✓ orcarouter-lite ready. API key: sk-orca-abc123... ``` -------------------------------- ### Savings Widget Example Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.pt.md Example of how to query for cost savings compared to a baseline model. ```APIDOC ## GET /v1/analytics/savings ### Description Reports the cost savings achieved by using OrcaRouter compared to a specified baseline model over a given period. This data powers the savings tile in the dashboard. ### Method GET ### Endpoint /v1/analytics/savings ### Query Parameters - **baseline** (string) - Required - The baseline model for comparison (e.g., `gpt-4o`). - **days** (integer) - Required - The number of past days to calculate savings for (e.g., `7`). ### Example ```bash GET /v1/analytics/savings?baseline=gpt-4o&days=7 ``` ``` -------------------------------- ### Node.js Example: Use 'auto' model Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/design/index.html Example demonstrating how to use the 'auto' model with the OpenAI SDK in Node.js. The router will automatically select the cheapest capable model. ```javascript import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'http://localhost:8000/v1', apiKey: 'sk-orca-YOUR-KEY', }); const completion = await client.chat.completions.create({ model: 'auto', messages: [{ role: 'user', content: 'Hello world' }], }); ``` -------------------------------- ### Get Savings Analytics Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.fr.md Example of fetching savings analytics. This endpoint shows the potential cost savings by comparing your actual traffic cost against always using a baseline model like GPT-4. ```bash GET /v1/analytics/savings?baseline=gpt-4&days=7 ``` -------------------------------- ### Prompt Caching Example Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.pt.md Demonstrates how prompt caching works with deterministic requests. ```APIDOC ## Prompt Cache Behavior ### Description Deterministic requests (e.g., `temperature=0` or fixed `seed`) are served from the cache, resulting in instant responses with `x-orca-cache: HIT` and zero cost. ### Example Request (First Call) ```bash curl ... -d '{"model":"auto","messages":[...], "temperature": 0}' -i ``` ### Example Response (First Call) ```http HTTP/1.1 200 OK x-orca-cache: MISS x-orca-resolved-model: gpt-4o-mini ``` ### Example Request (Second Call - Same Payload) ```bash curl ... # same payload as above ``` ### Example Response (Second Call - Cached) ```http HTTP/1.1 200 OK x-orca-cache: HIT # Served from cache, no upstream call ``` ``` -------------------------------- ### Cache Prompt Example (Miss) Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.fr.md Example of a cache miss for a prompt request. The response includes 'x-orca-cache: MISS' and indicates the resolved model. ```bash $ curl ... -d '{"model":"auto","messages":[...], "temperature": 0}' -i HTTP/1.1 200 OK x-orca-cache: MISS x-orca-resolved-model: gpt-4o-mini ``` -------------------------------- ### Clone and Run OrcaRouter Lite with Docker Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.it.md Clone the repository, set up your environment variables, and start the service using Docker Compose. Ensure you add at least one provider API key to the .env file. ```bash git clone https://github.com/Continuum-AI-Corp/OrcaRouter-Lite.git cd OrcaRouter-Lite cp .env.example .env # aggiungi almeno una: OPENAI_API_KEY=sk-... docker compose up ``` -------------------------------- ### Curl Example: Use 'auto' model Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/design/index.html Example demonstrating how to use the 'auto' model with curl. The router will automatically select the cheapest capable model. ```bash curl http://localhost:8000/v1/chat/completions \ -H "Authorization: Bearer sk-orca-YOUR-KEY" \ -d '{"model": "auto", "messages": [{"role": "user", "content": "Hello world"}]}' ``` -------------------------------- ### Run OrcaRouter Lite with Uvicorn Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/design/index.html This command starts the OrcaRouter Lite server using Uvicorn. The API key is printed to the console on the first run. ```bash uvicorn app.main:app ``` -------------------------------- ### Cache Prompt Cross-Provider Example Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.it.md Demonstrates how deterministic requests with temperature=0 or a fixed seed are served from the cache. Cache hits are indicated by the 'x-orca-cache: HIT' header and do not incur upstream costs. ```bash $ curl ... -d '{"model":"auto","messages":[...], "temperature": 0}' -i HTTP/1.1 200 OK x-orca-cache: MISS x-orca-resolved-model: gpt-4o-mini $ curl ... # stesso payload di nuovo HTTP/1.1 200 OK x-orca-cache: HIT ← servito dalla cache, nessuna chiamata upstream ``` -------------------------------- ### Cross-Provider Prompt Caching Example Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.zh.md Demonstrates the use of prompt caching. The first request shows a cache MISS, while the second identical request shows a cache HIT, indicating no upstream call was made and a $0 cost. ```bash $ curl ... -d '{"model":"auto","messages":[...], "temperature": 0}' -i HTTP/1.1 200 OK x-orca-cache: MISS x-orca-resolved-model: gpt-4o-mini $ curl ... # 同样的 payload 再来一次 HTTP/1.1 200 OK x-orca-cache: HIT ← 来自缓存,无上游调用 ``` -------------------------------- ### Run OrcaRouter Lite with Docker Compose Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/design/index.html This command starts the OrcaRouter Lite server using Docker Compose. The API key is printed to the console on the first run. ```bash docker compose up ``` -------------------------------- ### Cache Prompt Example (Hit) Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.fr.md Example of a cache hit for a repeated prompt request with the same deterministic parameters. The response indicates 'x-orca-cache: HIT', meaning it was served from the cache and cost $0. ```bash $ curl ... # même payload, deuxième fois HTTP/1.1 200 OK x-orca-cache: HIT ← servi depuis le cache, pas d'appel upstream ``` -------------------------------- ### Clone and Run OrcaRouter Lite (Self-Hosted) Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.de.md Clone the repository, set up your environment variables with API keys, and start the Docker Compose service to run OrcaRouter Lite locally. Ensure you have at least one provider API key configured. ```bash git clone https://github.com/Continuum-AI-Corp/OrcaRouter-Lite.git cd OrcaRouter-Lite cp .env.example .env # mindestens einen hinzufügen: OPENAI_API_KEY=sk-... # oder ORCAROUTER_API_KEY=... docker compose up # logs: ✓ orcarouter-lite ready. API key: sk-orca-abc123... ``` -------------------------------- ### Clone and Run OrcaRouter Lite (Self-hosted) Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.ru.md Clone the repository, set up your environment variables with at least one provider API key, and start the Docker Compose service to run OrcaRouter Lite locally. ```bash git clone https://github.com/Continuum-AI-Corp/OrcaRouter-Lite.git cd OrcaRouter-Lite cp .env.example .env # добавьте хотя бы один: OPENAI_API_KEY=sk-... docker compose up # logs: ✓ orcarouter-lite ready. API key: sk-orca-abc123... ``` -------------------------------- ### Use Hosted OrcaRouter Service Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.es.md Register on the OrcaRouter website to use the hosted service. This eliminates the need for local setup and Docker, allowing you to point any OpenAI SDK to their API. ```bash # 1. Register at https://www.orcarouter.ai and copy your sk-orca-* key # 2. Use https://api.orcarouter.ai/v1 as the base URL ``` -------------------------------- ### Hosted OrcaRouter Usage Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.pt.md For the hosted version, register on `https://www.orcarouter.ai`, obtain your `sk-orca-*` key, and use `https://api.orcarouter.ai/v1` as your base URL. No local setup is required. ```bash # 1. Registre-se em https://www.orcarouter.ai e copie sua chave sk-orca-* # 2. Use https://api.orcarouter.ai/v1 como URL base ``` -------------------------------- ### Run OrcaRouter Lite Tests Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.it.md Install development dependencies and run the test suite for OrcaRouter Lite using pytest. This ensures all behaviors have corresponding tests. ```bash pip install -e ".[dev]" PYTHONPATH=. pytest -v ``` -------------------------------- ### Python OpenAI SDK Usage Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.fr.md Example of using the OpenAI Python SDK to interact with OrcaRouter Lite. Replace the base URL and API key with your specific details. Supports `model="auto"` for dynamic model selection. ```python from openai import OpenAI client = OpenAI( base_url="http://localhost:8000/v1", api_key="sk-orca-abc123...", ) r = client.chat.completions.create( model="auto", # ou "gpt-4o-mini", "claude-3-5-sonnet-latest", ... messages=[{"role": "user", "content": "Hello!"}], ) print(r.choices[0].message.content) ``` -------------------------------- ### Python OpenAI SDK Integration Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.it.md Integrate with OrcaRouter Lite using the OpenAI Python SDK. Set the base URL to your local instance and use the provided API key. This example demonstrates a basic chat completion request. ```python from openai import OpenAI client = OpenAI( base_url="http://localhost:8000/v1", api_key="sk-orca-abc123...", ) r = client.chat.completions.create( model="auto", # o "gpt-4o-mini", "claude-3-5-sonnet-latest", ... messages=[{"role": "user", "content": "Hello!"}], ) print(r.choices[0].message.content) ``` -------------------------------- ### Hosted Fallback Status Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.md Check the status of the hosted fallback service, which is used to drive the dashboard's "Get $5 free credit" card. ```APIDOC ## GET /v1/hosted ### Description Get the status of the hosted fallback service. ### Method GET ### Endpoint /v1/hosted ``` -------------------------------- ### Deploy OrcaRouter Lite on Fly.io Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.fr.md Instructions for deploying OrcaRouter Lite using Fly.io. This involves launching the application with a Dockerfile. ```bash fly launch --dockerfile Dockerfile ``` -------------------------------- ### Self-Host OrcaRouter Lite with Docker Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.ko.md Clone the repository, set up your environment variables with API keys, and run OrcaRouter Lite using Docker Compose. The logs will display the API key to use for requests. ```bash git clone https://github.com/Continuum-AI-Corp/OrcaRouter-Lite.git cd OrcaRouter-Lite cp .env.example .env # add at least one: OPENAI_API_KEY=sk-... docker compose up # logs: ✓ orcarouter-lite ready. API key: sk-orca-abc123... ``` -------------------------------- ### Configure OrcaRouter Lite for Hosted Fallback Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.ko.md To enable a hosted fallback, set the `ORCAROUTER_API_KEY` environment variable in your `.env` file to your hosted OrcaRouter API key. ```bash # .env ORCAROUTER_API_KEY=sk-orca-hosted-abc... ``` -------------------------------- ### Deploy OrcaRouter Lite with Docker Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.fr.md Command to run OrcaRouter Lite using a Docker image. Ensure to set the OPENAI_API_KEY environment variable. ```bash docker run -p 8000:8000 -e OPENAI_API_KEY=... ghcr.io/... ``` -------------------------------- ### Reproduce OrcaRouter Benchmark Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/BENCHMARK.md Run the OrcaRouter benchmark locally using the provided Python script and prompt file. ```bash python bench/run.py --prompts bench/prompts.jsonl ``` -------------------------------- ### Automatic Model Selection with Vision Capabilities (Python) Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.de.md Demonstrates using `model='auto'` with multimodal input (text and image) in Python. OrcaRouter Lite will select the most cost-effective model capable of handling the vision request. ```python client.chat.completions.create( model="auto", messages=[{"role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, {"type": "image_url", "image_url": {"url": "data:..."}}, ]}], ) ``` -------------------------------- ### Use Aider with Different Models Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/integrations/aider.md Demonstrates how to specify various OpenAI-compatible models when running Aider. The 'openai/' prefix indicates that Aider should use the OpenAI-compatible HTTP path provided by OrcaRouter Lite. ```bash aider --model openai/auto # ← cheapest capable per request aider --model openai/gpt-4o aider --model openai/claude-3-5-sonnet-latest aider --model openai/gemini-2.5-flash ``` -------------------------------- ### List Models Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.zh.md Discover available models and their details. ```APIDOC ## GET /v1/models ### Description Retrieves a catalog of discoverable models, including over 100 models from `litellm.model_cost`. ### Method GET ### Endpoint /v1/models ### Response #### Success Response (200) - **data** (array) - A list of model objects, each containing details like `id`, `owned_by`, and `capabilities`. #### Response Example ```json { "data": [ { "id": "gpt-4o-mini", "object": "model", "created": 1700000000, "owned_by": "openai", "capabilities": { "completion_capabilities": { "completion_type": "chat" } }, "description": "OpenAI's fastest and most capable model." } ] } ``` ``` -------------------------------- ### Using 'auto' model with Image Input Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.hi.md This Python code demonstrates sending an image along with text to the 'auto' model. OrcaRouter Lite will select the cheapest vision-capable model available to process the request. The resolved model is returned in the response header. ```python client.chat.completions.create( model="auto", messages=[{"role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, {"type": "image_url", "image_url": {"url": "data:..."}}, ]}], ) # → आपकी कुंजियों द्वारा कवर सबसे सस्ते VISION-सक्षम मॉडल पर रूट करता है ``` -------------------------------- ### Call OrcaRouter Lite with Node.js SDK Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.de.md Interact with OrcaRouter Lite using the OpenAI Node.js SDK. Set the `baseURL` to your local OrcaRouter Lite instance and provide the `apiKey`. The `model: 'auto'` option automatically selects the most suitable model. ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "http://localhost:8000/v1", apiKey: "sk-orca-abc123...", }); const r = await client.chat.completions.create({ model: "auto", messages: [{ role: "user", content: "Hello!" }], }); console.log(r.choices[0].message.content); ``` -------------------------------- ### OrcaRouter Lite Project Structure Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.md Overview of the directory structure for the OrcaRouter Lite project, detailing the purpose of key files and directories. ```text app/ ├── main.py FastAPI factory + lifespan + SPA mount ├── config.py Settings (~15 fields) ├── deps.py DI helpers ├── seed.py First-run bootstrap ├── auto_routing.py model="auto" capability + cost scoring ├── router_cache.py Single-workspace router ├── prompt_cache.py Cross-provider exact-match cache (Redis or in-memory LRU) ├── schemas.py OpenAI-compatible request schema ├── middleware/auth.py sk-orca-* validation └── routes/ ├── chat.py /v1/chat/completions (blocking + streaming) ├── models.py /v1/models ├── providers.py BYOK CRUD ├── routing.py strategy config ├── analytics.py recent / spend / latency / savings / unreachable ├── keys.py list / rotate / revoke API keys ├── hosted.py /v1/hosted — hosted-fallback status for the dashboard └── health.py packages/ ├── litellm_adapter/ Router wrapper + 100+ model catalog ├── auth/ hashing + AES-256-GCM └── db/ models + engine + session ``` -------------------------------- ### Using `model="auto"` for Vision Requests Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.zh.md Demonstrates how to use `model="auto"` with image content in a chat completion request. OrcaRouter will select the cheapest vision-capable model available. ```python client.chat.completions.create( model="auto", messages=[{"role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, {"type": "image_url", "image_url": {"url": "data:..."}}, ]}], ) # → Routes to your cheapest vision-enabled model ``` -------------------------------- ### Node.js OpenAI SDK Integration Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.ru.md Integrate OrcaRouter Lite with your Node.js application using the OpenAI SDK. Set the `baseURL` to your OrcaRouter Lite instance and use the provided API key. ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "http://localhost:8000/v1", apiKey: "sk-orca-abc123...", }); const r = await client.chat.completions.create({ model: "auto", messages: [{ role: "user", content: "Hello!" }], }); console.log(r.choices[0].message.content) ``` -------------------------------- ### Two-Model Edit/Whole Pattern with Aider Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/integrations/aider.md Configure Aider to use a cheaper model for proposing changes and a more expensive model for confirming them. This optimizes cost and quality for editing tasks. ```bash aider \ --model openai/auto \ --weak-model openai/claude-3-5-haiku-latest ``` -------------------------------- ### Persistent Aider Configuration Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/integrations/aider.md Set up persistent configuration for Aider using a YAML file. This avoids the need to set environment variables repeatedly. ```yaml openai-api-base: http://localhost:8000/v1 openai-api-key: sk-orca-PASTE-YOUR-KEY-HERE model: openai/auto weak-model: openai/claude-3-5-haiku-latest ``` -------------------------------- ### Python OpenAI SDK Integration Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.ru.md Integrate OrcaRouter Lite with your Python application using the OpenAI SDK. Set the `base_url` to your OrcaRouter Lite instance and use the provided API key. ```python from openai import OpenAI client = OpenAI( base_url="http://localhost:8000/v1", api_key="sk-orca-abc123...", ) r = client.chat.completions.create( model="auto", # или "gpt-4o-mini", "claude-3-5-sonnet-latest", ... messages=[{"role": "user", "content": "Hello!"}], ) print(r.choices[0].message.content) ``` -------------------------------- ### Set Environment Variables for Aider Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/integrations/aider.md Configure Aider to use OrcaRouter Lite by setting the OPENAI_API_BASE and OPENAI_API_KEY environment variables. This allows Aider to communicate with the Lite instance. ```bash export OPENAI_API_BASE=http://localhost:8000/v1 export OPENAI_API_KEY=sk-orca-PASTE-YOUR-KEY-HERE ``` -------------------------------- ### OrcaRouter Lite Roadmap Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.md The development roadmap for OrcaRouter Lite, indicating completed and planned features. ```text - [x] OpenAI-compatible chat completions - [x] Streaming (SSE) - [x] `model="auto"` cheapest-capable routing - [x] Hosted-as-upstream - [x] Encrypted BYOK at rest - [x] Local analytics dashboard - [x] CI (GitHub Actions) - [x] Cross-provider prompt caching - [x] Continue.dev / Aider / LangChain / Cursor / Vercel AI SDK integrations - [x] Public benchmark + savings claim - [ ] Embeddings + image-gen proxy ``` -------------------------------- ### Chat Completion with Python SDK Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.es.md Integrate OrcaRouter Lite into your Python application using the OpenAI SDK. Ensure your base URL and API key are correctly configured for either the self-hosted or hosted service. ```python from openai import OpenAI client = OpenAI( base_url="http://localhost:8000/v1", api_key="sk-orca-abc123...", ) r = client.chat.completions.create( model="auto", # or "gpt-4o-mini", "claude-3-5-sonnet-latest", ... messages=[{"role": "user", "content": "Hello!"}], ) print(r.choices[0].message.content) ``` -------------------------------- ### Simulate OpenAI Provider Failure Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/DEMO.md Executes a script to simulate the failure of the OpenAI API provider during the demo. This triggers OrcaRouter Lite to switch to an alternative provider. ```bash ./scripts/demo_kill_openai.sh ``` -------------------------------- ### Restore OpenAI Provider Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/DEMO.md Restores the OpenAI API provider after the demo. This is a cleanup step to return the environment to its initial state. ```bash ./scripts/demo_restore_openai.sh ``` -------------------------------- ### Streaming Chat Completions in Python Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.ko.md Enable streaming for chat completions by setting `stream=True`. OrcaRouter Lite supports OpenAI-compatible SSE format with standard framing and a `[DONE]` sentinel. ```python for chunk in client.chat.completions.create( model="auto", messages=[{"role": "user", "content": "Tell me a story"}], stream=True, ): print(chunk.choices[0].delta.content or "", end="", flush=True) ``` -------------------------------- ### Chat Completions Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.zh.md Proxy and stream chat completions with automatic model selection and cross-provider prompt caching. ```APIDOC ## POST /v1/chat/completions ### Description Proxies and streams chat completions. Supports `model="auto"` for automatic model selection and cross-provider prompt caching. ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Request Body - **model** (string) - Required - The model to use for chat completions. Can be `"auto"`. - **messages** (array) - Required - The messages to send to the model. - **temperature** (number) - Optional - Controls randomness. Set to 0 for deterministic requests for caching. - **seed** (integer) - Optional - Fixed seed for deterministic requests for caching. ### Request Example ```json { "model": "auto", "messages": [ {"role": "user", "content": "Hello!"} ], "temperature": 0 } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the completion. - **object** (string) - Type of object returned, e.g., `chat.completion`. - **created** (integer) - Unix timestamp of creation. - **model** (string) - The model used for the completion. - **choices** (array) - List of completion choices. - **usage** (object) - Usage statistics. - **x-orca-cache** (string) - Indicates if the response was served from cache (`HIT` or `MISS`). #### Response Example ```json { "id": "chatcmpl-123", "object": "chat.completion", "created": 1700000000, "model": "gpt-4o-mini", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello there! How can I help you today?" }, "logprobs": null, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 10, "completion_tokens": 20, "total_tokens": 30 }, "x-orca-cache": "MISS" } ``` ``` -------------------------------- ### Chat Completions Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.it.md Proxy requests to AI models, with support for streaming, cross-provider prompt caching, and automatic model selection. ```APIDOC ## POST /v1/chat/completions ### Description Proxies chat completion requests to various AI models. Supports streaming responses, cross-provider prompt caching, and automatic model selection (`model="auto"`). ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Query Parameters - **stream** (boolean) - Optional - Whether to stream the response. #### Request Body - **model** (string) - Required - The model to use. Can be `"auto"` to let OrcaRouter select the best model. - **messages** (array) - Required - The conversation messages. - **temperature** (number) - Optional - Controls randomness. Set to 0 for deterministic responses (enables caching). - **seed** (integer) - Optional - A seed for deterministic responses (enables caching). ### Request Example ```json { "model": "auto", "messages": [{"role": "user", "content": "Tell me a story"}], "temperature": 0 } ``` ### Response #### Success Response (200) - **choices** (array) - The model's response choices. - **x-orca-resolved-model** (string) - Header indicating the model actually used. - **x-orca-cache** (string) - Header indicating if the response was served from cache (`HIT` or `MISS`). #### Response Example ```json { "choices": [ { "delta": { "content": "Once upon a time..." } } ] } ``` ``` -------------------------------- ### Routing Strategy Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.it.md Configure the routing strategy for selecting AI models. ```APIDOC ## GET/PUT /v1/routing ### Description Retrieves or sets the model routing strategy. Strategies include `balanced`, `cheapest`, `fastest`, and `quality`. ### Method GET, PUT ### Endpoint /v1/routing ### Request Body (for PUT) - **strategy** (string) - Required - The desired routing strategy (e.g., `balanced`, `cheapest`). ``` -------------------------------- ### Call OrcaRouter Lite with curl Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.de.md Make a request to the OrcaRouter Lite API using curl. Ensure the `Authorization` header includes your OrcaRouter API key and the `Content-Type` is set to `application/json`. ```bash curl http://localhost:8000/v1/chat/completions \ -H "Authorization: Bearer sk-orca-abc123..." \ -H "Content-Type: application/json" \ -d '{"model":"auto","messages":[{"role":"user","content":"Hello!"}]}' ``` -------------------------------- ### Discoverable Model Catalog Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.md Retrieve a catalog of over 100 chat models loaded at startup. This endpoint returns an OpenAI-format catalogue. ```APIDOC ## GET /v1/models ### Description Returns the OpenAI-format catalogue of available chat models. ### Method GET ### Endpoint /v1/models ### Response #### Success Response (200) - **id** (string) - Model identifier (e.g., `gpt-4o`, `claude-3-5-sonnet-latest`). - **provider** (string) - The provider of the model. - **supports_tools** (boolean) - Flag indicating if the model supports tools. - **supports_vision** (boolean) - Flag indicating if the model supports vision. - **supports_json_mode** (boolean) - Flag indicating if the model supports JSON mode. - **cost** (object) - Per-token input/output cost. - **input** (number) - Cost per input token. - **output** (number) - Cost per output token. ``` -------------------------------- ### Routing Strategy Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.pt.md Configure and retrieve the routing strategy for model selection. ```APIDOC ## GET/PUT /v1/routing ### Description Allows users to view or change the model routing strategy (e.g., `balanced`, `cheapest`, `fastest`, `quality`). ### Method GET, PUT ### Endpoint /v1/routing ### Request Body (for PUT) - **strategy** (string) - Required - The desired routing strategy (e.g., `balanced`, `cheapest`). ``` -------------------------------- ### Routing Strategy Source: https://github.com/continuum-ai-corp/orcarouter-lite/blob/main/README.zh.md Configure and retrieve the routing strategy for model selection. ```APIDOC ## Routing Configuration ### Description Allows switching between different routing strategies: `balanced`, `cheapest`, `fastest`, or `quality`. ### Methods - GET /v1/routing - PUT /v1/routing ### Endpoint `/v1/routing` ### Parameters #### Request Body (for PUT) - **strategy** (string) - Required - The routing strategy to set. Options: `balanced`, `cheapest`, `fastest`, `quality`. ### Response #### Success Response (200) - For GET: The current routing strategy. - For PUT: Confirmation of the strategy update. #### Response Example (GET) ```json { "strategy": "balanced" } ``` ```