mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 21:32:10 +03:00
Ollama Cloud exposes a native Anthropic-compatible /v1/messages endpoint. A Claude-format client (sourceFormat="claude") is now routed straight to it instead of through the lossy claude->openai->ollama bridge, preserving thinking blocks, tool-use ids, and image fidelity. Narrow, single-provider port — NOT a generic transport-selection framework: - registry: new optional `claudeBaseUrl` on ollama-cloud (mirrors the existing `responsesBaseUrl` precedent) → https://ollama.com/v1/messages. - resolveChatCoreTargetFormat: a Claude-format client on the allowlisted ollama-cloud provider resolves targetFormat="claude" (skips the openai bridge). - resolveExecutionCredentials: stamps a marker read by the executor. - DefaultExecutor.buildUrl/buildHeaders: route to claudeBaseUrl and add the Anthropic-Version header on that path; auth stays Authorization: Bearer. - hasValidContent: recognize image/document-only Claude messages so an attachment-only turn is no longer dropped as empty on the passthrough. TDD regression guards: tests/unit/chatcore-target-format.test.ts, tests/unit/chatcore-execution-credentials.test.ts, tests/unit/executor-ollama-cloud-claude-passthrough.test.ts, tests/unit/translator-helper-branches.test.ts. Co-authored-by: thienpv <pvtcwd@gmail.com> Inspired-by: https://github.com/decolua/9router/pull/2475