Files
OmniRoute/docs/API_REFERENCE.md
Diego Rodrigues de Sa e Souza 99c6dc7fd6 Release v3.7.9 (#1917)
* chore(release): v3.7.9 — gemini-cli cloud code separation

* chore(provider): Update Jina AI model catalog (#1874)

Integrated into release/v3.7.9

* docs: update CHANGELOG for PR 1874 and retroactive credits

* fix: resolve stream defaults and codex prompt mapping (#1873, #1872)

* chore(compression): start caveman compression update

* feat(compression): expand caveman compression and analytics pipeline

Add caveman intensity levels, output mode instructions, validation, and
preview diffs across the compression pipeline.

Extend MCP and dashboard settings to support auto-trigger mode, system
prompt preservation, MCP description compression, and caveman rule
metadata. Record richer compression analytics with receipt fields,
validation fallbacks, output mode data, and add the related database
migration.

Improve preservation handling for code, URLs, markdown, math, and other
protected content while adding broad unit, integration, and golden-set
coverage for caveman parity and compression behavior.

* feat(compression): expose rule intensities and track usd savings

Add estimated USD savings to compression analytics so saved tokens can
be reported in cost terms alongside existing token metrics.

Expose caveman rule intensity metadata for settings consumers and add a
settings API route alias for rule lookup. Also preserve system prompts
when aggressive compression falls back to lite mode.

* feat(compression): RTK compression roadmap (#1889)

* chore(rtk): initialize compression roadmap branch

* feat(compression): add RTK engine and compression combos

Introduce RTK command-aware tool-output compression alongside
stacked RTK -> Caveman pipelines for mixed prompt contexts.

Add engine registration, declarative RTK filter packs, language-aware
Caveman rule loading, compression combo persistence and assignments,
analytics grouped by engine/combo, and new MCP/API endpoints for
configuration, previews, filters, and combo management.

Expose the new capabilities in the dashboard with dedicated Context &
Cache pages for Caveman, RTK, and compression combos, and update docs,
i18n strings, migrations, and tests to cover the expanded compression
surface.

* feat(compression): expand RTK DSL, filter catalog, and recovery APIs

Add RTK parity features across the compression pipeline, dashboard,
and management APIs. This expands the built-in filter catalog, adds
trust-gated custom filter loading, inline filter verification, code
stripping, smarter detection, and optional redacted raw-output
retention for authenticated recovery.

Also extend Caveman with file-based multilingual rule packs, localized
output-mode instructions, stricter preview/config schemas, engine
registry metadata, analytics fields, and broad unit test coverage for
RTK, rule loading, and stacked compression behavior.

* fix(auth): protect oauth routes and health reset operations

Require authenticated dashboard access for OAuth endpoints that can
create or import provider connections when login enforcement is
enabled.

Move `/api/monitoring/health` to the readonly public route list so
safe methods remain public while DELETE now returns 401 for anonymous
requests.

Also update Next.js native `.node` handling to avoid webpack parse
failures from external packages such as ngrok and keytar, and add
coverage for the new auth behavior.

* build(compression): ship RTK rule and filter assets with app bundles

Include compression JSON assets in Next output tracing, prepublish copies,
and pack artifact policy checks so standalone and packaged builds can
load RTK filters and caveman rule packs at runtime.

Also harden compression runtime behavior by resolving alternate asset
directories, scoping rule cache entries by source path, carrying RTK raw
output pointers through stacked runs, degrading oversized preview diffs,
and applying combo language/output mode defaults during chat routing.

Add coverage for packaging rules, provider-scoped model parsing, smart
truncate edge cases, raw output retention, and combo-driven compression
behavior.

* docs(workflows): update local repo paths to OmniRoute

Replace outdated `/home/diegosouzapw/dev/proxys/9router` references
with the current `OmniRoute` directory across deploy, release, and
version bump workflow guides so local command examples match the
renamed repository layout

* feat(compression): complete RTK parity coverage

* test(build): align next config assertions

---------

Co-authored-by: diegosouzapw <diego.souza.pw@gmail.com>

* feat(compression): expand caveman parity and MCP metadata compression

Compress MCP registry and list metadata descriptions for tools, prompts,
resources, and resource templates while keeping tool-response bodies
unchanged. Expose those savings in compression status as
`mcp_metadata_estimate` metadata rather than provider usage.

Add Caveman rule-pack support for custom regex flags and match-specific
replacement maps, update English rules for upstream parity, and tighten
article and pleasantry handling. Also process RTK multipart text blocks
independently so mixed media content compresses safely without
duplicating output.

* feat(compression): unify config validation and persist MCP savings

Centralize compression config schemas across settings, preview, RTK,
and combo APIs to enforce consistent validation for stacked pipelines
and engine-specific options.

Expand caveman and stacked compression behavior by applying default
combos at runtime, surfacing validation and fallback metadata, and
exposing aggressive and ultra adapter schemas for configuration UI and
tests.

Persist MCP description compression snapshots into analytics without
counting them as provider usage, and extend the dashboard with the new
RTK controls and localized labels.

* fix(auth): require dashboard management auth for compression preview

Block preview requests unless they come from a valid management session
token so protected settings cannot be probed through the preview API.

Add unit coverage for unauthenticated requests, invalid bearer tokens,
and successful authenticated preview execution.

* fix(compression): preserve stacked defaults and secure metadata routes

Only apply saved default compression combos when they contain a stacked
pipeline so seeded Caveman-only defaults do not replace the builtin
stacked behavior.

Also require management auth for compression language pack and rules
metadata endpoints, and defer usage receipt attachment until compression
analytics writes have completed to keep analytics records consistent.

* fix(compression): align seeded standard savings combo with stacked default

Update the seeded default compression combo to use the RTK then
Caveman pipeline in both fresh installs and upgraded databases.

Add a targeted migration and runtime guard that only rewrites the
legacy seeded record when its original metadata and single-step
pipeline still match, preserving user-customized default combos.
Refresh docs and tests to reflect the stacked default and expanded
RTK filter catalog.

* docs(compression): document RTK+Caveman stacked savings ranges

Refresh the compression docs and README to describe the default
stacked pipeline in terms of eligible-context savings instead of the
older generic token-saving range.

Add upstream RTK and Caveman benchmark references, explain the
multiplicative savings math behind the stacked default, and update
feature summaries plus package metadata to match the revised
positioning.

* feat(image-gen): add NanoGPT image generation provider (#1899)

Integrated into release/v3.7.9

* fix(codex): sanitize raw responses input (#1895)

Integrated into release/v3.7.9

* Fix combo provider breaker profile handling (#1891)

Integrated into release/v3.7.9

* fix(combos): align strategy contracts (#1892)

Integrated into release/v3.7.9

* feat(proxy): move proxy configuration to dedicated System → Proxy page (#1907)

Integrated into release/v3.7.9

* feat: add K/M/B/T cost shortener to prevent UI overflow (#1902)

Integrated into release/v3.7.9

* feat(providers): implement bulk paste for extra API keys (#1916)

Integrated into release/v3.7.9

* fix(migrations): treat duplicate-column ALTER as no-op (#1886)

Integrated into release/v3.7.9

* fix(analytics): robust model pricing resolution, dark mode charts and SQL aggregation fixes (#1896)

Integrated into release/v3.7.9 (migration renumbered to 044)

* fix(oauth): per-connection mutex for rotating refresh tokens (#1885)

Integrated into release/v3.7.9

* fix: resolve 3 bugs — Codex tool normalization (#1914), image gen proxy (#1904), zero-arg MCP tools (#1898)

- fix(codex): flatten Chat Completions tool format to Responses format in
  normalizeCodexTools. Prevents 'Missing required parameter: tools[0].name'
  upstream errors when clients send {type:'function', function:{name,...}}
  instead of {type:'function', name,...}.

- fix(proxy): add proxy-aware execution context to image generation route.
  Image requests now correctly use proxy settings from the connection's
  ProxyRegistry assignment, matching the pattern used by chat pipeline.

- fix(translator): inject properties:{} into zero-argument MCP tool schemas
  during Anthropic→OpenAI translation. OpenAI strict mode requires explicit
  properties even for empty object schemas.

Closes #1914, Closes #1904, Closes #1898

* chore(release): v3.7.9 — all changes in ONE commit

* fix: allow local ollama provider connections (#1893)

* fix(copilot): emit compatible reasoning text deltas (#1919)

Integrated into release/v3.7.9

* fix(api-manager): show validation errors inline in modals, not behind backdrop (#1920)

Integrated into release/v3.7.9

* docs: update changelog and pr body with merged prs

* fix(providers): route agentrouter through anthropic endpoint headers

Update the AgentRouter provider registry to use the Claude-compatible
messages API and required Anthropic-style authentication headers. This
bypasses unauthorized_client_error responses and exposes the supported
model list through passthrough configuration.

Also update the changelog and release PR notes to document the fix for
#1921

* feat(logs): show compression tokens in request log UI (#1923)

* docs: add PR #1923 to changelog

---------

Co-authored-by: diegosouzapw <diego.souza.pw@gmail.com>
Co-authored-by: backryun <bakryun0718@proton.me>
Co-authored-by: Aculeasis <42580940+Aculeasis@users.noreply.github.com>
Co-authored-by: Raxxoor <manker_lol@hotmail.com>
Co-authored-by: Randi <55005611+rdself@users.noreply.github.com>
Co-authored-by: Paijo <14921983+oyi77@users.noreply.github.com>
Co-authored-by: Tubagus <54710482+0xtbug@users.noreply.github.com>
Co-authored-by: smartenok-ops <smartenok@gmail.com>
Co-authored-by: Gi99lin <74502520+Gi99lin@users.noreply.github.com>
Co-authored-by: ivan-mezentsev <ivan@mezentsev.me>
Co-authored-by: Andrew Munsell <andrew@wizardapps.net>
2026-05-04 01:36:53 -03:00

20 KiB

API Reference

🌐 Languages: 🇺🇸 English | 🇧🇷 Português (Brasil) | 🇪🇸 Español | 🇫🇷 Français | 🇮🇹 Italiano | 🇷🇺 Русский | 🇨🇳 中文 (简体) | 🇩🇪 Deutsch | 🇮🇳 हिन्दी | 🇹🇭 ไทย | 🇺🇦 Українська | 🇸🇦 العربية | 🇯🇵 日本語 | 🇻🇳 Tiếng Việt | 🇧🇬 Български | 🇩🇰 Dansk | 🇫🇮 Suomi | 🇮🇱 עברית | 🇭🇺 Magyar | 🇮🇩 Bahasa Indonesia | 🇰🇷 한국어 | 🇲🇾 Bahasa Melayu | 🇳🇱 Nederlands | 🇳🇴 Norsk | 🇵🇹 Português (Portugal) | 🇷🇴 Română | 🇵🇱 Polski | 🇸🇰 Slovenčina | 🇸🇪 Svenska | 🇵🇭 Filipino | 🇨🇿 Čeština

Complete reference for all OmniRoute API endpoints.


Table of Contents


Chat Completions

POST /v1/chat/completions
Authorization: Bearer your-api-key
Content-Type: application/json

{
  "model": "cc/claude-opus-4-6",
  "messages": [
    {"role": "user", "content": "Write a function to..."}
  ],
  "stream": true
}

Custom Headers

Header Direction Description
X-OmniRoute-No-Cache Request Set to true to bypass cache
X-OmniRoute-Progress Request Set to true for progress events
X-Session-Id Request Sticky session key for external session affinity
x_session_id Request Underscore variant also accepted (direct HTTP)
Idempotency-Key Request Dedup key (5s window)
X-Request-Id Request Alternative dedup key
X-OmniRoute-Cache Response HIT or MISS (non-streaming)
X-OmniRoute-Idempotent Response true if deduplicated
X-OmniRoute-Progress Response enabled if progress tracking on
X-OmniRoute-Session-Id Response Effective session ID used by OmniRoute

Nginx note: if you rely on underscore headers (for example x_session_id), enable underscores_in_headers on;.


Embeddings

POST /v1/embeddings
Authorization: Bearer your-api-key
Content-Type: application/json

{
  "model": "nebius/Qwen/Qwen3-Embedding-8B",
  "input": "The food was delicious"
}

Available providers: Nebius, OpenAI, Mistral, Together AI, Fireworks, NVIDIA, OpenRouter, GitHub Models.

# List all embedding models
GET /v1/embeddings

Image Generation

POST /v1/images/generations
Authorization: Bearer your-api-key
Content-Type: application/json

{
  "model": "openai/dall-e-3",
  "prompt": "A beautiful sunset over mountains",
  "size": "1024x1024"
}

Available providers: OpenAI (DALL-E, GPT Image 1), xAI (Grok Image), Together AI (FLUX), Fireworks AI, Nebius (FLUX), Hyperbolic, NanoBanana, OpenRouter, SD WebUI (local), ComfyUI (local).

# List all image models
GET /v1/images/generations

List Models

GET /v1/models
Authorization: Bearer your-api-key

→ Returns all chat, embedding, and image models + combos in OpenAI format

Compatibility Endpoints

Method Path Format
POST /v1/chat/completions OpenAI
POST /v1/messages Anthropic
POST /v1/responses OpenAI Responses
POST /v1/embeddings OpenAI
POST /v1/images/generations OpenAI
GET /v1/models OpenAI
POST /v1/messages/count_tokens Anthropic
GET /v1beta/models Gemini
POST /v1beta/models/{...path} Gemini generateContent
POST /v1/api/chat Ollama

Dedicated Provider Routes

POST /v1/providers/{provider}/chat/completions
POST /v1/providers/{provider}/embeddings
POST /v1/providers/{provider}/images/generations

The provider prefix is auto-added if missing. Mismatched models return 400.


Semantic Cache

# Get cache stats
GET /api/cache/stats

# Clear all caches
DELETE /api/cache/stats

Response example:

{
  "semanticCache": {
    "memorySize": 42,
    "memoryMaxSize": 500,
    "dbSize": 128,
    "hitRate": 0.65
  },
  "idempotency": {
    "activeKeys": 3,
    "windowMs": 5000
  }
}

Dashboard & Management

Authentication

Endpoint Method Description
/api/auth/login POST Login
/api/auth/logout POST Logout
/api/settings/require-login GET/PUT Toggle login required

Provider Management

Endpoint Method Description
/api/providers GET/POST List / create providers
/api/providers/[id] GET/PUT/DELETE Manage a provider
/api/providers/[id]/test POST Test provider connection
/api/providers/[id]/models GET List provider models
/api/providers/validate POST Validate provider config
/api/provider-nodes* Various Provider node management
/api/provider-models GET/POST/PATCH/DELETE Custom models (add, update, hide/show, delete)

OAuth Flows

Endpoint Method Description
/api/oauth/[provider]/[action] Various Provider-specific OAuth

Routing & Config

Endpoint Method Description
/api/models/alias GET/POST Model aliases
/api/models/catalog GET All models by provider + type
/api/combos* Various Combo management
/api/keys* Various API key management
/api/pricing GET Model pricing

Usage & Analytics

Endpoint Method Description
/api/usage/history GET Usage history
/api/usage/logs GET Usage logs
/api/usage/request-logs GET Request-level logs
/api/usage/[connectionId] GET Per-connection usage

Settings

Endpoint Method Description
/api/settings GET/PUT/PATCH General settings
/api/settings/proxy GET/PUT Network proxy config
/api/settings/proxy/test POST Test proxy connection
/api/settings/ip-filter GET/PUT IP allowlist/blocklist
/api/settings/thinking-budget GET/PUT Reasoning token budget
/api/settings/system-prompt GET/PUT Global system prompt
/api/settings/compression GET/PUT Global compression config

Context & Compression

Endpoint Method Description
/api/compression/preview POST Preview off/lite/standard/aggressive/ultra/RTK/stacked compression
/api/compression/language-packs GET List available Caveman language packs
/api/compression/rules GET List Caveman rule metadata
/api/context/caveman/config GET/PUT Caveman-specific settings alias
/api/context/rtk/config GET/PUT RTK-specific settings, including custom filters and raw-output retention
/api/context/rtk/filters GET RTK filter catalog and custom-filter diagnostics
/api/context/rtk/test POST Run RTK preview/test against a text payload
/api/context/rtk/raw-output/[id] GET Read retained redacted raw output by pointer id
/api/context/combos GET/POST Compression combo list/create
/api/context/combos/[id] GET/PUT/DELETE Compression combo detail/update/delete
/api/context/combos/[id]/assignments GET/PUT Assign compression combos to routing combos
/api/context/analytics GET Compression analytics alias

Monitoring

Endpoint Method Description
/api/sessions GET Active session tracking
/api/rate-limits GET Per-account rate limits
/api/monitoring/health GET Health check + provider summary (catalogCount, configuredCount, activeCount, monitoredCount)
/api/cache/stats GET/DELETE Cache stats / clear

Backup & Export/Import

Endpoint Method Description
/api/db-backups GET List available backups
/api/db-backups PUT Create a manual backup
/api/db-backups POST Restore from a specific backup
/api/db-backups/export GET Download database as .sqlite file
/api/db-backups/import POST Upload .sqlite file to replace database
/api/db-backups/exportAll GET Download full backup as .tar.gz archive

Cloud Sync

Endpoint Method Description
/api/sync/cloud Various Cloud sync operations
/api/sync/initialize POST Initialize sync
/api/cloud/* Various Cloud management

Tunnels

Endpoint Method Description
/api/tunnels/cloudflared GET Read Cloudflare Quick Tunnel install/runtime status for the dashboard
/api/tunnels/cloudflared POST Enable or disable the Cloudflare Quick Tunnel (action=enable/disable)
/api/tunnels/ngrok GET Read ngrok Tunnel runtime status for the dashboard
/api/tunnels/ngrok POST Enable or disable the ngrok Tunnel (action=enable/disable)

CLI Tools

Endpoint Method Description
/api/cli-tools/claude-settings GET Claude CLI status
/api/cli-tools/codex-settings GET Codex CLI status
/api/cli-tools/droid-settings GET Droid CLI status
/api/cli-tools/openclaw-settings GET OpenClaw CLI status
/api/cli-tools/runtime/[toolId] GET Generic CLI runtime

CLI responses include: installed, runnable, command, commandPath, runtimeMode, reason.

ACP Agents

Endpoint Method Description
/api/acp/agents GET List all detected agents (built-in + custom) with status
/api/acp/agents POST Add custom agent or refresh detection cache
/api/acp/agents DELETE Remove a custom agent by id query param

GET response includes agents[] (id, name, binary, version, installed, protocol, isCustom) and summary (total, installed, notFound, builtIn, custom).

Resilience & Rate Limits

Endpoint Method Description
/api/resilience GET/PATCH Get/update request queue, connection cooldown, provider breaker, and wait settings
/api/resilience/reset POST Reset provider circuit breakers
/api/rate-limits GET Per-account rate limit status
/api/rate-limit GET Global rate limit configuration

Evals

Endpoint Method Description
/api/evals GET/POST List eval suites / run evaluation

Policies

Endpoint Method Description
/api/policies GET/POST/DELETE Manage routing policies

Compliance

Endpoint Method Description
/api/compliance/audit-log GET Compliance audit log (last N)

v1beta (Gemini-Compatible)

Endpoint Method Description
/v1beta/models GET List models in Gemini format
/v1beta/models/{...path} POST Gemini generateContent endpoint

These endpoints mirror Gemini's API format for clients that expect native Gemini SDK compatibility.

Internal / System APIs

Endpoint Method Description
/api/init GET Application initialization check (used on first run)
/api/tags GET Ollama-compatible model tags (for Ollama clients)
/api/restart POST Trigger graceful server restart
/api/shutdown POST Trigger graceful server shutdown
/api/system/env/repair POST Repair OAuth provider environment variables
/api/system-info GET Generate system diagnostics report

Note: These endpoints are used internally by the system or for Ollama client compatibility. They are not typically called by end users.

OAuth Environment Repair (v3.6.1+)

POST /api/system/env/repair
Content-Type: application/json

{
  "provider": "claude-code"
}

Repairs missing or corrupted OAuth environment variables for a specific provider. Returns:

{
  "success": true,
  "repaired": ["CLAUDE_CODE_OAUTH_CLIENT_ID", "CLAUDE_CODE_OAUTH_CLIENT_SECRET"],
  "backupPath": "/home/user/.omniroute/backups/env-repair-2026-04-11.bak"
}

Audio Transcription

POST /v1/audio/transcriptions
Authorization: Bearer your-api-key
Content-Type: multipart/form-data

Transcribe audio files using Deepgram or AssemblyAI.

Request:

curl -X POST http://localhost:20128/v1/audio/transcriptions \
  -H "Authorization: Bearer your-api-key" \
  -F "file=@recording.mp3" \
  -F "model=deepgram/nova-3"

Response:

{
  "text": "Hello, this is the transcribed audio content.",
  "task": "transcribe",
  "language": "en",
  "duration": 12.5
}

Supported providers: deepgram/nova-3, assemblyai/best.

Supported formats: mp3, wav, m4a, flac, ogg, webm.


Ollama Compatibility

For clients that use Ollama's API format:

# Chat endpoint (Ollama format)
POST /v1/api/chat

# Model listing (Ollama format)
GET /api/tags

Requests are automatically translated between Ollama and internal formats.


Telemetry

# Get latency telemetry summary (p50/p95/p99 per provider)
GET /api/telemetry/summary

Response:

{
  "providers": {
    "claudeCode": { "p50": 245, "p95": 890, "p99": 1200, "count": 150 },
    "github": { "p50": 180, "p95": 620, "p99": 950, "count": 320 }
  }
}

Budget

# Get budget status for all API keys
GET /api/usage/budget

# Set or update a budget
POST /api/usage/budget
Content-Type: application/json

{
  "keyId": "key-123",
  "limit": 50.00,
  "period": "monthly"
}

Request Processing

  1. Client sends request to /v1/*
  2. Route handler calls handleChat, handleEmbedding, handleAudioTranscription, or handleImageGeneration
  3. Model is resolved (direct provider/model or alias/combo)
  4. Credentials selected from local DB with account availability filtering
  5. For chat: handleChatCore checks semantic/signature cache and resolves combo compression settings
  6. Proactive compression runs before provider translation when enabled (lite, Caveman, RTK, or stacked)
  7. Provider executor sends upstream request
  8. Response translated back to client format (chat) or returned as-is (embeddings/images/audio)
  9. Usage, compression analytics, and request logs are recorded
  10. Fallback applies on errors according to combo rules

Full architecture reference: ARCHITECTURE.md


Authentication

  • Dashboard routes (/dashboard/*) use auth_token cookie
  • Login uses saved password hash; fallback to INITIAL_PASSWORD
  • requireLogin toggleable via /api/settings/require-login
  • /v1/* routes optionally require Bearer API key when REQUIRE_API_KEY=true