Repository navigation
Route Anthropic Messages requests through compatible engines - #47
Merged
Merged
Conversation
Port NVIDIA/Personal-AI-Router@7b21d1f from NVIDIA#27, originally addressing NVIDIA#16, to the fork's three engine-specific proxies. Ollama 0.14.0, LM Studio 0.4.1, and oMLX 0.1.0 all expose the Messages endpoint in their documented APIs. Classify POST /v1/messages as inference so it uses existing model eligibility, scheduling, failover, and first-body stall cooldown without translation. Keep oMLX's OpenAI usage-field injection off Messages requests so streamed Anthropic bodies pass through unchanged. Cover route roles, owner filtering, header and body passthrough, JSON and unbuffered SSE failover, stall cooldown, post-commit truncation, and older engine errors. Extend strict cross-process routing for all three engines, document compatibility, and bump each proxy to the additive 1.5.0 version. Co-authored-by: Ratherrayees <145657835+Ratherrayees@users.noreply.github.com> Signed-off-by: Jared Ping <13906915+JaredP94@users.noreply.github.com>
JaredP94
force-pushed
the
feat/anthropic-messages-route
branch
from
November 4, 2026 12:26
ad0ded9 to
76e6535
Compare
Owner
Author
|
CI note before merge: on run 41888792614, five of six jobs passed, including both cross-process jobs (Linux: 107 passed, 0 skipped). The "Go modules (macos-15)" job was cancelled four times with "The job was not acquired by Runner of type hosted even after multiple attempts" (GitHub macOS arm64 capacity constraints). It never started. That job's exact steps were run instead on macOS arm64 at 76e6535 with the CI toolchain (Go 1.26.7): |
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.
Description
Port NVIDIA/Personal-AI-Router@7b21d1f (NVIDIA#27, originally addressing NVIDIA#16) to the fork's separate engine proxies. Anthropic clients such as Claude Code can send
POST /v1/messagesthrough the existing model-owner selection, scheduler, failover, and workload lifecycle, without protocol translation.All three engines qualify based on their own published APIs:
Scope
stream_optionsinjection.ollama-proxy,lmstudio-proxy, andomlx-proxyto 1.5.0: this is an additive HTTP feature, and the existing unreleased patch bumps do not cover it relative to v0.8.0. No product release or changelog update is included.Validation
Local environment: macOS arm64, Go 1.27.3.
Passed in each of
services/ollama-proxy,services/lmstudio-proxy, andservices/omlx-proxy:gofmt -l .(empty)go vet ./...GOOS=linux go vet ./...GOOS=windows go vet ./...go test -count=1 -v ./...go test -race -count=1 -run '^TestMessages' .Passed in
services/tests: formatting and native/Linux/Windows vet as above. Cross-process execution is deliberately reserved for PR CI, not run locally.Passed at repository root:
node scripts/spdx-headers.mjs(0 missing) andgit diff --check.PR CI is currently blocked, not verified: GitHub's active service incident affects Git operations, pull requests, API requests, and Actions. After ten minutes no workflow run or check had appeared for this branch; all six required PR jobs remain unconfirmed. Cross-process execution remains deferred to CI.
Regression evidence:
TestMessagesRouteRolefailed before adding the route. With the route added but the oMLX usage-injection exclusion absent,TestMessagesModelRoutingAndFailover/ssefailed its unchanged-request check; it passes with the exclusion. Real HTTP tests require the first SSE event before the engine is released to finish, and verify a truncated committed stream never contacts a replacement owner.The opt-in live oMLX affinity test skipped because its live-engine environment was not configured. No real engine was installed, modified, or used. Desktop was untouched.
Risk
These are engine-native Messages APIs, not Anthropic feature-parity guarantees. The documented minimum versions are required; PAIR does not negotiate API versions. An older engine's unsupported-endpoint response (typically 404) can fail over only through eligible model owners, and the final upstream error is returned if no candidate succeeds. It cannot route to a different model. Existing authentication and loopback/cluster policies remain unchanged;
x-api-keydoes not authenticate a client to PAIR.Checklist
git commit -s), certifying the Developer Certificate of Origin.services/versions.json, and described user-visible changes above so they reach the release notes.