Repository navigation
feat(gateway): serve Anthropic Messages alongside the OpenAI protocols - #15
Merged
Merged
Conversation
The provider speaks three wire protocols and the router answered two: a client of Anthropic Messages had no route, no validator and no provider type. Add POST /v1/messages, a `messages` API type, and one table each for the per-type upstream path and the validator that reads the body. Forward vision, tool calling and reasoning unchanged on all three routes, and refuse only what the provider itself refuses (`input_audio`, `file`) with a 400 that names the position and the type. Bound the client arrays and the tool schema before a provider slot is spent. Add STREAM_BY_DEFAULT for the absent-`stream` case only, the provider contract the tests read against, and a dashboard option list derived from the server's own apiTypes answer.
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.
What
Adds the provider's third wire protocol as a first-class surface:
POST /v1/messages(Anthropic Messages) routed only tomessages-typed providers,answering
404 endpoint_not_availablewhen the fleet has none.messagesprovider API type, with one table each for the upstream path(
API_TYPE_PATHS) and the body validator, so the third protocol cannot half-exist.parts the provider itself refuses (
input_audio,file) are rejected, with a 400 thatnames the position and the type.
STREAM_BY_DEFAULTfor the absent-streamcase only; an explicitstream: falsestill answers JSON.
apiTypes.Verification
pnpm run check— syntax and imports (62 files), workflow pinning.pnpm run typecheck— clean.pnpm run test:web— 35 tests pass.pnpm test— 159 unit checks, 497 smoke checks (524 withSMOKE_SLOW=1).pnpm run check:commits— the branch's commit follows CONTRIBUTING.md.