Docker / publish (push) Canceled after 0s
Release / crates-io (push) Canceled after 0s
Release / release (macos-14, aarch64-apple-darwin) (push) Canceled after 0s
Release / release (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Canceled after 0s
Release / release (windows-latest, x86_64-pc-windows-msvc) (push) Canceled after 0s
router.allaigate.com now resolves and serves a valid certificate, so the hosted routing API no longer has to be reached by bare IP with certificate verification switched off. Make https://router.allaigate.com the default [router].url with verify_tls = true. Existing configs still pointing at 138.226.222.209 (with or without a scheme or a trailing slash) are moved to the hostname on load and have verification restored, then saved: it is the same machine, and this is the difference between a verified connection and a blind one. A self-hosted router URL is left untouched. README, docs/ROUTER.md (both languages), config/gateway.example.toml and bench/accuracy.py follow. Verified live: the migration rewrites a legacy config on startup, admin health reports the hostname reachable over verified TLS (389 ms), and real requests route through it - "math"/medium 0.416 and "translation"/low 0.268 with route_source=router.
156 lines
7.5 KiB
TOML
156 lines
7.5 KiB
TOML
# ============================================================================
|
|
# Cortiq Gateway — example configuration
|
|
# Copy to gateway.toml and edit for your own model pool.
|
|
# Do NOT store secrets here — provide them via *_env (environment variables)
|
|
# or set them from the admin console (stored in config/secrets.toml).
|
|
# ============================================================================
|
|
|
|
listen = "0.0.0.0:9000"
|
|
|
|
# --- connection to cortiq-router (decides task type / complexity) -----------
|
|
# Hosted allaigate router: url = "https://router.allaigate.com" (the default)
|
|
# (cert is bound to an IP), taxonomy_id = "data-assistant", a cortiq_… key in
|
|
# CORTIQ_ROUTER_KEY.
|
|
# NOTE: on hard prompts the router escalates to an oracle LLM (~10 s) — for the
|
|
# hosted router set timeout_ms = 12000+, otherwise the gateway degrades to default.
|
|
[router]
|
|
url = "https://router.allaigate.com" # hosted allaigate router (or your own cortiq-router URL)
|
|
api_key_env = "CORTIQ_ROUTER_KEY" # name of the env var holding the router key
|
|
timeout_ms = 12000 # hard prompts escalate to an oracle (~10 s)
|
|
taxonomy_id = "data-assistant" # the hosted router's task taxonomy
|
|
verify_tls = false # the hosted endpoint is IP-bound; true for your own domain
|
|
|
|
# --- how to pick the text to classify from the conversation -----------------
|
|
[route]
|
|
text_strategy = "last_user" # last_user | last_user_plus_system | concat_all
|
|
max_chars = 4000
|
|
cache_ttl = "60s"
|
|
profile = "balanced" # cost-saver | balanced | quality-first
|
|
|
|
# ============================================================================
|
|
# Model pool — EMPTY by default. A fresh gateway starts with no models and an
|
|
# empty pool; add them in the admin console (/admin → Models), or run a local
|
|
# .cmf via the [cmf] section below. To add one by hand, copy this shape:
|
|
#
|
|
# [[models]]
|
|
# id = "my-model"
|
|
# provider = "openai" # openai | anthropic (openai also covers
|
|
# base_url = "http://127.0.0.1:8081/v1" # OpenRouter/Together/Groq/vLLM/Ollama)
|
|
# model = "my-model"
|
|
# # api_key_env = "OPENAI_API_KEY" # for hosted providers (never inline a key)
|
|
# cost_tier = "local"
|
|
# caps = ["tools"]
|
|
# ============================================================================
|
|
|
|
# ============================================================================
|
|
# Routing table: complexity tier → ordered pool (priority = fallback chain).
|
|
# Leave default empty for a fresh install; set it to a model id once you add one.
|
|
# ============================================================================
|
|
[routing]
|
|
low = []
|
|
medium = []
|
|
high = []
|
|
default = "" # set to a model id once you add one
|
|
|
|
[routing.policy]
|
|
mode = "fixed_table" # fixed_table | cost_aware
|
|
# for cost_aware:
|
|
# min_class = { low = "cheap", medium = "mid", high = "expensive" }
|
|
# max_cost_usd_per_request = 0.50
|
|
|
|
# --- resilience -------------------------------------------------------------
|
|
[breaker]
|
|
threshold = 5
|
|
cooldown = "30s"
|
|
|
|
# ============================================================================
|
|
# Inbound protocols — enable only what you need (toggles apply live in the UI)
|
|
# ============================================================================
|
|
[protocols]
|
|
openai_chat = true
|
|
openai_completions = true
|
|
openai_embeddings = true
|
|
openai_models = true
|
|
anthropic_messages = true
|
|
mcp = false
|
|
native_passthrough = true
|
|
|
|
# --- response routing metadata ----------------------------------------------
|
|
[cortiq]
|
|
echo = true # add a "cortiq" field to the response body (X-Cortiq-* headers are always sent)
|
|
|
|
# ============================================================================
|
|
# Authentication: virtual gateway keys (agents get these, not provider keys).
|
|
# If this section is empty, the gateway runs in open mode (local development).
|
|
# ============================================================================
|
|
[[api_keys]]
|
|
key = "sk-gw-team-a"
|
|
account = "team-a"
|
|
rate_per_min = 600
|
|
# allow_models = ["cortiq-auto", "cmf-local"] # restrict available models (optional)
|
|
|
|
# --- idempotency and logging ------------------------------------------------
|
|
[idempotency]
|
|
ttl = "10m"
|
|
|
|
[log]
|
|
bodies = false # do NOT log message bodies (privacy) — default
|
|
level = "info"
|
|
|
|
[telemetry]
|
|
metrics = true # GET /metrics (Prometheus)
|
|
otlp_endpoint_env = "OTEL_EXPORTER_OTLP_ENDPOINT" # optional
|
|
|
|
# ============================================================================
|
|
# Admin web console — embedded in the binary, served at /admin
|
|
# ============================================================================
|
|
[admin]
|
|
enabled = true
|
|
# Name of the env var holding the admin token. If unset (or empty), a token is
|
|
# generated at startup and printed to the log (see also the --admin-token flag).
|
|
token_env = "CORTIQ_ADMIN_TOKEN"
|
|
# listen = "127.0.0.1:9001" # optional: separate bind for admin (default: main listen)
|
|
|
|
# ============================================================================
|
|
# Request statistics (dashboard + /metrics). Kept in memory + appended to JSONL.
|
|
# ============================================================================
|
|
[stats]
|
|
enabled = true
|
|
file = "config/stats.jsonl" # empty = in-memory only
|
|
ring_size = 500 # how many recent requests to keep in the feed
|
|
retention = "7d" # aggregate/series depth (replayed on startup)
|
|
# stats.jsonl is compacted once it exceeds this size: old records fold into
|
|
# cumulative per-account totals (sidecar file), so per-key accounting survives
|
|
# while the disk stays bounded. 0 disables.
|
|
max_file_mb = 16
|
|
|
|
# ============================================================================
|
|
# Semantic cache — returns a cached answer for prompts semantically near a
|
|
# previous one, skipping the model call. Requires an embedding model in the pool.
|
|
# Disabled by default. (Cache settings take effect on restart.)
|
|
# ============================================================================
|
|
[cache]
|
|
enabled = false
|
|
threshold = 0.92 # cosine similarity for a hit (0..1)
|
|
ttl = "1h"
|
|
max_entries = 1000
|
|
# embed_model = "local-embed" # defaults to the first kind = "embedding" model
|
|
|
|
# ============================================================================
|
|
# Local CMF model server. The gateway can install/run a local .cmf via cortiq
|
|
# (github.com/infosave2007/cmf) and register it as the "cmf-local" model above,
|
|
# so it works even when the router and cloud providers are unavailable.
|
|
# Changes to manage_server / local_model / threads / gpu apply on restart.
|
|
# ============================================================================
|
|
[cmf]
|
|
manage_server = false # true → gateway spawns `cortiq serve` at startup
|
|
local_model = "models/model.cmf" # path to the .cmf to serve
|
|
local_host = "127.0.0.1"
|
|
local_port = 8081 # confirm it's free in Settings → "Check port" (8081 often clashes with Docker/Apache)
|
|
model_id = "cmf-local" # id it registers under (matches [[models]])
|
|
threads = 8 # decode worker threads (CMF_THREADS); ~3x vs serial
|
|
gpu = false # offload matvecs to GPU (Metal/wgpu); mainly a prefill win
|
|
cortiq_bin = "cortiq" # the cortiq CLI (cargo install cortiq-cli)
|
|
auto_install = false # install cortiq-cli from crates.io if the binary is missing
|
|
local_only = false # true → route every request to the local model
|