Summary
Configure OpenRouter as the primary inference provider for managed model usage in OpenCompany. This replaces or sits in front of the current TinyHumans-hosted inference endpoint, giving access to OpenRouter's full model catalogue with a single API key.
What to Add
- Inference URL:
https://openrouter.ai/api/v1 (OpenAI-compatible)
- API key: stored as a secret (same pattern as
%k-inference%2Fkey in the company secrets dir) — key to be supplied by the operator at deploy time via OPENCOMPANY_INFERENCE_KEY or equivalent secret injection
- Provider identity header: OpenRouter requires
HTTP-Referer and optionally X-Title on each request for attribution — these should be set to the OpenCompany instance URL and product name respectively
Scope
- Default inference URL — update the fallback/default value in
src/server/ops/inference.rs (or wherever OPENCOMPANY_INFERENCE_URL is resolved) so a fresh deploy without explicit config points at OpenRouter
- Header injection — ensure
HTTP-Referer: <public_url> and X-Title: OpenCompany are sent on every inference request to satisfy OpenRouter's attribution requirement
- Model name mapping — OpenRouter uses namespaced model IDs (e.g.
anthropic/claude-sonnet-4-5, openai/gpt-4o). Verify the model IDs in company configs resolve correctly against OpenRouter's catalogue, or add a mapping layer
- Docs — update
docs/spec/runtime/ and the company README.md to document OpenRouter as the recommended managed provider and note the required env vars
Not in Scope
- Per-company BYOK (bring-your-own-key) OpenRouter — that's a separate settings surface
- Rate-limit or cost tracking per model — tracked separately
Acceptance Criteria
Summary
Configure OpenRouter as the primary inference provider for managed model usage in OpenCompany. This replaces or sits in front of the current TinyHumans-hosted inference endpoint, giving access to OpenRouter's full model catalogue with a single API key.
What to Add
https://openrouter.ai/api/v1(OpenAI-compatible)%k-inference%2Fkeyin the company secrets dir) — key to be supplied by the operator at deploy time viaOPENCOMPANY_INFERENCE_KEYor equivalent secret injectionHTTP-Refererand optionallyX-Titleon each request for attribution — these should be set to the OpenCompany instance URL and product name respectivelyScope
src/server/ops/inference.rs(or whereverOPENCOMPANY_INFERENCE_URLis resolved) so a fresh deploy without explicit config points at OpenRouterHTTP-Referer: <public_url>andX-Title: OpenCompanyare sent on every inference request to satisfy OpenRouter's attribution requirementanthropic/claude-sonnet-4-5,openai/gpt-4o). Verify the model IDs in company configs resolve correctly against OpenRouter's catalogue, or add a mapping layerdocs/spec/runtime/and the companyREADME.mdto document OpenRouter as the recommended managed provider and note the required env varsNot in Scope
Acceptance Criteria
OPENCOMPANY_INFERENCE_URL=https://openrouter.ai/api/v1+OPENCOMPANY_INFERENCE_KEY=<key>produces working inference in a local dev runHTTP-RefererandX-Titleheaders are present on outbound inference requests/api/v1/company/capabilitiesreturnscognition: "configured"with an OpenRouter key set