Skip to content

Route Anthropic Messages requests through compatible engines - #47

Merged
JaredP94 merged 1 commit into
mainfrom
feat/anthropic-messages-route
Nov 4, 2026
Merged

JaredP94 merged 1 commit into
mainfrom
feat/anthropic-messages-route

Conversation

@JaredP94

@JaredP94 JaredP94 commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

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/messages through the existing model-owner selection, scheduler, failover, and workload lifecycle, without protocol translation.

All three engines qualify based on their own published APIs:

Scope

  • Add the inference classification to Ollama, LM Studio, and oMLX proxies.
  • Preserve request bodies, existing header forwarding, response JSON, and unbuffered SSE. Exclude Messages from oMLX's OpenAI-only stream_options injection.
  • Exercise owner filtering, 404 failover, first-body stall cooldown, no retry after committed SSE bytes, and an older engine's clean HTTP error. Extend cross-process strict routing for all three proxies.
  • Update all three proxy READMEs and the application setup guide.
  • Bump ollama-proxy, lmstudio-proxy, and omlx-proxy to 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.
  • No new protocol conversion, authentication mechanism, dependencies, or JSON-RPC surface.

Validation

Local environment: macOS arm64, Go 1.27.3.

Passed in each of services/ollama-proxy, services/lmstudio-proxy, and services/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) and git 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: TestMessagesRouteRole failed before adding the route. With the route added but the oMLX usage-injection exclusion absent, TestMessagesModelRoutingAndFailover/sse failed 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-key does not authenticate a client to PAIR.

Checklist

  • I have read the Contributing Guidelines.
  • Every commit is signed off (git commit -s), certifying the Developer Certificate of Origin.
  • New or existing tests cover the change.
  • Relevant documentation is updated.
  • I checked the diff, changed filenames, and commit messages for credentials, private data, internal URLs, internal issue identifiers, and generated artifacts.
  • I recorded the validation commands and results above.
  • I bumped any affected component in services/versions.json, and described user-visible changes above so they reach the release notes.

@JaredP94 JaredP94 closed this Nov 4, 2026
@JaredP94 JaredP94 reopened this Nov 4, 2026
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
JaredP94 force-pushed the feat/anthropic-messages-route branch from ad0ded9 to 76e6535 Compare November 4, 2026 12:26
@JaredP94 JaredP94 closed this Nov 4, 2026
@JaredP94 JaredP94 reopened this Nov 4, 2026
@JaredP94

JaredP94 commented Nov 4, 2026

Copy link
Copy Markdown
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): gofmt -l services was clean, and go vet ./... plus go test -count=1 -timeout=5m ./... passed in all 16 modules (services/tests excluded, as in CI).

@JaredP94
JaredP94 merged commit 7b7cbf6 into main Nov 4, 2026
25 of 30 checks passed
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.

1 participant