Files
helexa/cortex.example.toml
T
grenadeandClaude Opus 5.5 b00a25e2f5
CI / Config consistency (push) Successful in 13s
CI / Classify changes (push) Successful in 19s
CI / Web (lint + typecheck + i18n + build) (push) Skipped
CI / Format (push) Successful in 14s
CI / Clippy (push) Successful in 2m46s
CI / Test (push) Successful in 6m30s
CI / CUDA type-check (push) Successful in 19m22s
CI / Build cortex SRPM (push) Skipped
CI / Build neuron SRPM (push) Skipped
CI / Publish cortex to COPR (push) Skipped
CI / Publish neuron to COPR (push) Skipped
CI / Bump version in source (push) Skipped
feat: one model, many cards — music replicas and scheduled dark windows (#397)
A mining rig's cards sit on PCIe x1 risers, where tensor parallelism
floods the bus, so a rig serves one independent copy of a model per
card. Solar-powered rigs also leave the mesh every evening.

neuron:
- `[harness.candle.audio] replicas = "per-device"` (or a device list, or
  `replicas` in a model's load spec) loads a copy of each music model on
  each card behind one model id. One admission controller per model has
  a slot per copy; an admitted render takes an idle copy from a
  round-robin ReplicaPool. A copy whose device fails is retired; a card
  that fails to load leaves the others serving.
- /health reports per-copy load and /models the copy count; the model's
  max_in_flight is the number of copies.
- `[availability] online = ["06:30-18:45"]` (UTC) announces the next dark
  window on /health, with a drain time `drain_secs` (default 900) ahead.

cortex:
- Hosts past their drain time take no new work or cold-loads.
- Silence inside an announced window marks the host unhealthy at once and
  is logged once on leaving and once on return, not warned every poll;
  /health reports nodes.scheduled_dark. Unannounced outages are unchanged.
- Least-busy routing weighs load as a share of the model's capacity, so
  an 8-copy rig is not ranked like a single card.
- `[audio_jobs] max_concurrent = 0`, now the default, sizes the render
  gate from the fleet's advertised music capacity (minimum 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ohK2pULMVJctL5B1Gixdp
2026-10-21 18:17:27 +03:00

137 lines
5.3 KiB
TOML

# cortex.example.toml — example configuration
#
# Copy to cortex.toml and adjust for your environment.
#
# Environment variable overrides use CORTEX_ prefix with __ separators:
# CORTEX_GATEWAY__LISTEN=0.0.0.0:31313
# Path to the model catalogue (limits, cost, pinning, aliases, feasibility).
# Defaults to the packaged location below; uncomment to override for a
# non-packaged / local run.
# models_config = "/etc/cortex/models.toml"
# NOTE: the deployed copy of this file carries secrets — the inference
# API keys under [[entitlements.keys]].
# It must be installed root:cortex 0640 (the package's %post and
# script/infra-setup.sh both enforce this); a world-readable 0644
# hands every local account those credentials.
[gateway]
listen = "0.0.0.0:31313"
metrics_listen = "0.0.0.0:31314"
[eviction]
strategy = "lru"
# Restart neurons after this many load/unload cycles to defragment VRAM.
# Set to 0 to disable.
defrag_after_cycles = 50
# -- Nodes ---------------------------------------------------------------
# Each [[nodes]] entry declares a neuron daemon in the fleet.
# Models are discovered by polling the neuron's /models endpoint.
# Pinned models (see models.toml) are never evicted.
[[nodes]]
name = "gpu-large"
endpoint = "http://gpu-large.internal:8080"
vram_mb = 49152 # e.g. 2x RTX 4090 (48 GB combined)
pinned = [
"your-org/large-model",
]
[[nodes]]
name = "gpu-medium"
endpoint = "http://gpu-medium.internal:8080"
vram_mb = 24576 # e.g. RTX 4090 (24 GB)
pinned = [
"your-org/medium-model",
]
[[nodes]]
name = "gpu-small"
endpoint = "http://gpu-small.internal:8080"
vram_mb = 12288 # e.g. RTX 3060 (12 GB)
pinned = [
"your-org/embedding-model",
]
# -- Entitlements (multi-tenant governance, #47) -------------------------
# Identity + per-key token budgets. Omit this section entirely for the
# legacy single-operator behaviour: requests are anonymous and uncapped.
#
# The local/static provider below is the source of truth for accounts,
# keys, and hard caps until the upstream clearing house exists. Identity
# rides standard bearer auth only — clients send
# Authorization: Bearer <key>
# no custom headers or body fields.
[entitlements]
# Reject unauthenticated requests with 401 invalid_api_key. Leave false
# (allow-anonymous) during rollout; flip to true once keys are issued.
require_auth = false
# One entry per API key.
[[entitlements.keys]]
key = "sk-example-rolling" # the bearer token the client sends
account_id = "team-research" # billable account (keys may share one)
key_id = "research-ci" # stable label for ledger/metrics (optional)
hard_cap = 5_000_000 # hard token cap over the window
# Rolling window that resets — over-cap requests get 429 rate_limit_exceeded
# + Retry-After, so well-behaved clients (opencode/AI SDK) back off and retry.
window = { kind = "rolling", seconds = 3600 }
[[entitlements.keys]]
key = "sk-example-balance"
account_id = "team-research"
key_id = "research-prepaid"
hard_cap = 20_000_000
# Hard balance, no reset — exhaustion returns 429 insufficient_quota
# (the client surfaces and stops). This is the default when `window` is
# omitted. Never 402.
window = { kind = "balance" }
[[entitlements.keys]]
key = "sk-example-infra"
account_id = "operator"
key_id = "infra"
# No hard_cap → uncapped operator infra key (own fleet, own use). Still
# metered for visibility.
# -- Upstream (helexa mesh) entitlements client (#57) --------------------
# When enabled, a bearer key NOT found in [[entitlements.keys]] above is
# validated against the helexa-upstream authority (mesh accounts), and its
# budget is reserved/settled there. Operator-local keys (incl. the infra
# key) never leave this process. Fail-closed: if upstream is unreachable a
# request is refused (503 + Retry-After), never served un-authorized.
# Disabled by default — a standalone operator runs purely local.
[upstream]
enabled = false
# url = "https://upstream.helexa.ai"
# Shared client bearer this cortex presents (maps to an operator_id
# upstream). Override via CORTEX_UPSTREAM__BEARER in prod.
# bearer = "replace-with-operator-client-secret"
# timeout_secs = 5
# How often to flush served-usage counters to upstream for reconciliation (#58).
# served_usage_report_interval_secs = 60
# -- Async audio generation jobs (#382) -----------------------------------
# Music renders take seconds to minutes, so /v1/audio/generations is a job
# API: submit, poll, fetch the audio. Job records and rendered audio live
# under `dir` and survive a restart (the packaged unit's StateDirectory
# creates /var/lib/cortex). All values below are the defaults.
[audio_jobs]
# dir = "/var/lib/cortex/audio-jobs"
# Finished jobs and their audio are deleted after this many hours.
# retention_hours = 72
# Renders running at once across the fleet; the rest queue in cortex.
# 0 follows the fleet: the in-flight capacity its loaded music models
# advertise, counting every replica on a multi-card host (minimum 1).
# max_concurrent = 0
# Dispatch attempts per job; a busy (429/503) model does not use one up.
# max_attempts = 2
# How long a job may wait on a busy model before failing, in seconds.
# queue_timeout_secs = 3600
# New jobs are refused (503) while the job directory's filesystem has less
# than this much free space, in MiB. 0 disables the check.
# min_free_mb = 10240