Support multiple inference endpoints per provider - #14
Merged
Conversation
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
force-pushed
the
claude/multi-inference-endpoints-t1t6L
branch
from
May 22, 2026 05:26
513d9d4 to
1c8a653
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.