Skip to content

Support multiple inference endpoints per provider - #14

Merged
ffaerber merged 4 commits into
mainfrom
claude/multi-inference-endpoints-t1t6L
May 22, 2026
Merged

Support multiple inference endpoints per provider#14
ffaerber merged 4 commits into
mainfrom
claude/multi-inference-endpoints-t1t6L

Conversation

@ffaerber

Copy link
Copy Markdown
Collaborator

Replaces the single OPENAI_BASE_URL/OPENAI_API_KEY env pair with an
endpoints.json file in the data dir listing one or more OpenAI-compatible
backends. The provider aggregates models across every reachable backend
and routes each job to whichever one advertised the model id; first
listed wins on collision. Lets operators run Ollama and OpenAI (or any
proxy) from the same provider.

claude added 4 commits May 22, 2026 05:25
Replaces the single OPENAI_BASE_URL/OPENAI_API_KEY env pair with an
endpoints.json file in the data dir listing one or more OpenAI-compatible
backends. The provider aggregates models across every reachable backend
and routes each job to whichever one advertised the model id; first
listed wins on collision. Lets operators run Ollama and OpenAI (or any
proxy) from the same provider.
When two endpoints both advertise the same model id (e.g. Ollama and
OpenAI both serving "llama3"), register each on-chain as
"<endpoint-name>/<modelId>" so the operator can publish two distinct
offerings at independent prices. Models served by a single endpoint
keep their bare id. The router rewrites the request's `model` field to
the backend-native id before forwarding. Endpoint names may not contain
"/" to keep the prefix split unambiguous.
Extend each endpoint with an optional `models` block keyed by the
backend-native model id (e.g. `{"llama3": {"inputBzz": "0.3",
"outputBzz": "1.5"}}`). Declared prices win over on-chain values on
startup, which still win over the env defaults. UI edits on the Models
page are mirrored back into endpoints.json atomically, so prices in
JSON, in memory, and on-chain stay in sync — and survive a chain RPC
outage on restart.
On startup (after building the offerings map from /v1/models) and on
every heartbeat that re-publishes offerings, write the resolved price
for each model back into its endpoint's `models` block. The file ends
up as a complete inventory after one boot — operators can read it to
see exactly what the provider serves, with the same prices that went
on-chain. No-op when nothing changed, so the file's mtime stays stable
across idle restarts.

Factored the write-back logic into setDeclaredPrice() so the admin UI
handler and the auto-sync share one path.
@ffaerber
ffaerber force-pushed the claude/multi-inference-endpoints-t1t6L branch from 513d9d4 to 1c8a653 Compare May 22, 2026 05:26
@ffaerber
ffaerber merged commit 9c7113d into main May 22, 2026
1 check passed
@ffaerber
ffaerber deleted the claude/multi-inference-endpoints-t1t6L branch May 22, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants