vLLM Anthropic Messages API endpoint

vLLM can serve clients written for the Anthropic Messages API from self-hosted models through /v1/messages and a token counting endpoint. This page covers what to verify before existing tools are pointed at it.

On this page

Why teams serve the Anthropic Messages API from vLLM

Teams serve the Anthropic Messages API from vLLM when existing tools or internal applications are already written against that API and the organization wants to keep those clients while running the models in infrastructure it controls. The answer is workable only if the Anthropic-style surface is verified for each model and each client, because the surface is not the same thing as the OpenAI-compatible endpoints that vLLM documents most prominently. The vLLM server, started with vllm serve, exposes OpenAI-compatible endpoints such as /v1/chat/completions and /v1/responses, so applications written for the OpenAI API can point at it according to the vLLM online serving docs. The Anthropic-style endpoints covered on this page, /v1/messages and the token counting endpoint, sit alongside those and must be confirmed against the release you run.

Do not assume the Anthropic surface behaves the same way across models. Chat templates, tool-call parsers, reasoning output and streaming events depend on the model family and the flags you start the server with, so a client that works against one model can fail against another. Confirm the exact endpoint behavior, supported request fields and response shapes in the online serving docs for your release, then record the result per model and per client. Pin the vLLM version you test, because the project ships new minor releases about every two weeks, and an upgrade can change what the endpoint accepts. Ask the team that owns each client which fields it sends, which it reads from responses, and how it handles errors, since those answers decide the test list.

Treat compatibility testing as the first deliverable, before any client is redirected. Run each tool against a staging server with the production model, the production flags and the production API key arrangement, and compare responses with what the client expects. Check that a client's API key handling works with the --api-key option, and remember that this option does not protect every route, so the endpoints you expose should be limited by a reverse proxy as the vLLM security docs recommend. A written pass or fail record per client gives the security and platform owners evidence to approve the change.

When this endpoint fits and when another path is safer

Clients already written for the Anthropic SDK or command-line tools often need only a base URL and key change, which leaves prompt, tool and streaming code untouched. That saving holds only if the client uses features the server implements the same way. The trade-off is that you inherit the compatibility surface of one vLLM release for that client, and you may need to hold the release until you retest. Check the vLLM online serving docs for the endpoint behavior in your target release.

  • Lowest change cost: Configuration edits may be the only work, so application code stays as it is.
  • Late feature gaps: Streaming events, tool-use blocks, thinking content and token counting are where mismatches appear, so test those paths, not only a simple chat request.
  • Upgrade pinning: A client that depends on one behavior can constrain when you upgrade vLLM.
  • Model name mapping: Some tools send model identifiers or headers the server does not expect, so confirm how each client names the model.

Before committing, confirm the exact vLLM version, the chat template behavior of your model, and a recorded test run of each client's most used workflow.

How /v1/messages and token counting map onto a vLLM server

A client written for the Anthropic Messages API sends its request to /v1/messages on the vllm serve process, and the server does the work that the Anthropic service would otherwise do. The model loaded at startup receives the request, the messages and system prompt are turned into a prompt by the chat template configured for that model, and the generated tokens are returned in the Messages response shape. The chat template is the first thing to verify. The vLLM docs state that a model must provide a chat template, or be given one with --chat-template, before the chat completions API works, and the same rendering step sits underneath the Messages path, so a model without a usable template will fail on this endpoint too. Check the template for each model variant you plan to serve, including any reasoning or tool-use variants, before you test the client.

A token counting endpoint lets a client estimate input size before it sends a long request, which matters when a tool trims context or chooses between models. Because the count depends on the same template and tokenizer that the server uses for generation, the number should match what the server would charge against its context window, not what a generic tokenizer reports. The exact endpoint names, request fields and response fields for both the Messages and token counting routes can change between vLLM releases, and the release calendar moves about every two weeks, so confirm them against the version you deploy in the vLLM releases and the online serving docs before writing client code against them.

Clients depend on three things beyond the request body: the response shape, the streaming behavior and the error format. Existing tools often parse fields such as stop reasons, content block types, usage counts and streamed event types, and they may retry based on HTTP status codes. Record one example response for each path your tools use, including a streamed response and a deliberately invalid request, and compare them with what the client expects. Any mismatch should be resolved either in the client or in a gateway in front of vLLM, and the decision should be made before the tools are pointed at production traffic.

Request flow from existing Anthropic clients to self-hosted models

The flow starts at client tools configured with a base URL pointing at an internal endpoint. An optional reverse proxy or gateway sits at the trust boundary and forwards only the paths meant for users, such as the Messages and token counting routes. The vLLM server translates those requests and runs inference on GPU capacity inside the internal network. Check that the proxy allowlist matches the endpoints you intend to expose, since the vLLM --api-key option does not cover every route on its own.

Client requests pass an allowlist at the trust boundary before reaching the GPU-backed model.

Server options that change Anthropic client behavior

This table lists the vLLM server settings that decide whether an Anthropic-style client can reach the server, find the model it requests and receive a usable response. Read each row against the vLLM documentation for the exact release you run, because route availability and flag names can change between releases. The main takeaway is that the API key does not protect every path, so the proxy allowlist and model naming should be settled before existing tools are pointed at the server.

Server settingEffect on Anthropic clientsWhen it fitsWhat to confirm
Model name sent by clientsRequests must name a model the server exposes, so the client's model ID has to match the served name exactly.Clients that hard-code a model ID from another provider.Confirm how the running release lists model names and test one request per model.
Served model nameSets the public name clients send, separate from the path of the weights on disk.Keeping an existing client configuration while swapping the underlying model.Confirm the setting's name in the online serving docs and that it applies to the Messages route.
Chat template (--chat-template)Messages requests are turned into chat prompts, so a model without a usable template can fail or answer poorly.Models whose tokenizer lacks a chat template, or whose bundled template needs an override.Confirm the template file for the model and test a multi-turn exchange with a tool result.
API key (--api-key)Checks a key on endpoints under the /v1 prefix, which is where the Messages route is expected to sit.Internal deployments where a reverse proxy also restricts access.Confirm the Messages path falls under /v1 in your release. The docs warn against relying on the key alone.
Paths outside the API keyEndpoints such as /metrics, /health, /pause, /resume, /abort_requests and /invocations are not covered by the key.Any server reachable from more than one trusted network segment.Confirm the reverse proxy allowlists only the paths clients need, including the Messages and token counting routes.
Anthropic-style route enablementWhether the Messages and token counting routes are served depends on the release and its flags.Only where the release documents these routes as available.Check release notes and the online serving docs for the exact flag, default state and route list before cutover.
Metrics endpoint (/metrics)Exposes request counts and latency by route, which helps confirm that client traffic reaches the intended endpoint.Teams that need to verify client traffic after a migration.Confirm which labels are exported in your release and restrict access to the endpoint.

Setting up the endpoint and testing it before cutover

This sequence takes a self-hosted vLLM server from a pinned release to a tested Anthropic Messages endpoint that existing clients can call safely. Each step ends with a check, so the cutover decision rests on observed behavior rather than assumptions.

  1. Pin a release from the supported line

    The platform team selects one vLLM release and records it in the deployment manifest, container image tag or package lock. vLLM ships new minor releases about every two weeks, so the team should pick a release on the line it intends to support and avoid floating tags such as latest. Confirm the release number against the vLLM GitHub releases page and read its notes for changes to the Messages API, token counting or the chat template handling. The step is done when the exact version string is written in version control and matches what the test host reports at startup.

  2. Deploy the model with its chat template

    The team starts the model on a test host with vllm serve, using the same accelerator type and tensor parallel layout planned for production. Models must provide a chat template, or receive one through the --chat-template option, before the chat completions API works, so confirm the template matches the model's documented format before going further. Record the startup flags, the model revision and the chat template source. The step is done when the server loads the weights without errors in its logs and answers a simple request on the OpenAI-compatible chat endpoint.

  3. Confirm messages and token counting respond

    An engineer sends a minimal request to the Messages endpoint and a token counting request to the companion endpoint, using curl or a short script with the same headers the client will send. Check the HTTP status, the response shape and the usage fields against the client's expectations. Also confirm that a request with an invalid model name or a malformed body returns a clear error rather than a server fault. The step is done when both endpoints return well-formed responses and the server logs show the requests were processed.

  4. Run a compatibility suite of real client calls

    The team runs the actual client software, or a test harness that replays its exact request patterns, through a fixed suite. The suite covers plain messages, system prompts, multi-turn conversations, streaming responses and tool use if the client depends on it. Store each request and response pair so results can be compared after changes. Where a client sends features the model's template does not support, record the gap as a blocking or accepted item. The step is done when every case in the suite has a recorded result and each failure has an owner and a decision.

  5. Compare outputs and error handling with expected behavior

    Engineers compare the recorded outputs against the behavior the client team expects, including stop reasons, token usage fields, streaming event order and how errors are reported. Test deliberate failures such as oversized prompts, unsupported parameters and invalid tool definitions, and confirm the client retries or surfaces them the way it does with its original provider. Output quality is judged by the client's owners on representative prompts, since a protocol match does not prove the model answers well. The step is done when the client owners sign off on each difference in writing.

  6. Add the reverse proxy allowlist

    Because the vLLM API key option does not cover every endpoint, the team places a reverse proxy in front of the server and allowlists only the paths meant for users, including the Messages and token counting paths. Administrative and operational paths such as metrics, health and pause or resume stay reachable only from internal monitoring networks. The team confirms this against the vLLM security documentation and tests that disallowed paths return a denial from the proxy. The step is done when a scan or manual request to each non-allowlisted path is refused from a client network.

  7. Stage traffic and keep a rollback path

    The platform team routes a small share of real traffic, or one internal team's traffic, to the new endpoint while the existing provider remains available. They watch error rates, latency, token usage and the metrics vLLM exposes at its metrics path, and compare them with the baseline. The rollout expands only after the client owners confirm the staged results, and the old configuration is kept ready for a fast switch back. The step is done when the staged traffic matches the test results and the rollback has been exercised once in a non-production setting.

What to test before pointing existing tools at it

Existing tools fail in small places: a missing response field, a stream the client cannot parse, or a token budget that is off by enough to truncate prompts. The checks below run against the same vLLM build and model you plan to serve, so failures show up before users and integrations depend on them.

Request and response schema fields

Build a set of recorded requests from the client, including system prompts, multi-turn messages, image blocks if used, and every optional parameter the client sets. Send them to /v1/messages and compare each response field the client reads against what it expects. Log every field that is ignored, renamed or returned with a different type, and decide whether the client or the server needs a change. Confirm the supported fields against the vLLM release you are pinning, since the surface changes between releases.

vLLM online serving docs

Streaming event handling

Streaming clients depend on event order, the start and stop of each content block, incremental deltas and the final stop reason. Test a streamed response with the same SDK version your tools use, and check that the client assembles the same final message as a non-streamed call. Also test a client disconnect mid-stream and a long generation, since a client that expects a clean terminal event may hang or retry when it does not receive one.

Token counting accuracy

Clients use token counts to decide how much context to send and how much to reserve for output. Compare the token counting endpoint's result with the usage numbers returned by a real generation for the same input, including the chat template, system prompt and any tool definitions. A gap in either direction matters: an undercount can overflow the context window, and an overcount can cause a client to trim useful history. Record the offset per model and use it in client budgeting.

Tool use and structured output behavior

If the client sends tool definitions or expects tool_use blocks, test each tool_choice mode the client uses, multi-tool turns, and tool results returned in the next request. Tool-call output depends on the model's chat template and the parser enabled for that model, so a model that calls tools well in one family can fail in another. Run the same prompts against each model you plan to serve and record malformed calls, missing arguments and calls the client cannot route.

Error codes and retry behavior

Trigger the failures the client must handle: an oversized prompt, an unknown model name, a malformed request, a server overloaded under concurrent load, and an interrupted connection. Record the HTTP status and error body for each, then check whether the SDK retries on that status and whether it respects any backoff header. Confirm that retries do not duplicate side effects such as tool executions, and set client timeouts that exceed the longest generation you expect.

Model name and authentication headers

Confirm the exact model string the client sends and map it to the served model name, since a mismatch returns an error that looks like an outage. Check which header carries the key, because the vLLM --api-key option protects /v1 endpoints but not /metrics, /health or several control endpoints. The security docs recommend a reverse proxy that allowlists only the paths users need, so verify that /v1/messages and the token counting path pass through while the rest are blocked.

vLLM security docs

Questions teams ask before serving Anthropic clients from vLLM

Does existing Anthropic SDK code work unchanged against a self-hosted vLLM server?

Often the request shape carries over, but you should not assume it does. vLLM exposes an Anthropic-style Messages endpoint, so client code that only changes its base URL and model name may run without edits. The gaps appear in details: how the model handles tool use blocks, streaming events, stop reasons, system prompts and token counting. Run your real client code against the endpoint and compare responses with a reference. Treat any difference you find as a decision: adapt the client, or document the limit for the teams that depend on it.

What does the compatibility test cover, and who should run it?

The test should cover every client behavior your teams rely on, not only a single chat call. A useful set includes plain messages, multi-turn history, streaming, tool calling with the tools your agents use, structured or long outputs, token counting, error handling and authentication. Application engineers should own the test cases because they know which behaviors matter. Platform engineers should run it against the exact model, chat template and vLLM version you plan to operate. Security staff should review the endpoints it reaches. Record the results so a later vLLM upgrade can be retested against the same cases.

Does vLLM itself cost money to run?

vLLM has no paid edition. Its Apache-2.0 license covers the engine, so the cost comes from the surrounding work. The main recurring cost is accelerator capacity, whether GPUs you own or rent in your cloud accounts or data centers. Other costs include storage, networking, monitoring, backups and the people who implement, test, patch and operate the service. Implementation effort is usually one-time, while capacity and operations recur. Ask any partner for a quote that separates these components, and ask which parts are one-time and which continue every month.

How long does a pilot take, and what makes it longer or shorter?

Duration depends on how many client tools you need to match and how much of the environment already exists. The biggest drivers are the number of client applications and tools, the number of behaviors each one uses, whether tool calling and streaming are in scope, the model and chat template you choose, the accelerator hardware available to you, and how quickly security and network approvals come through. A narrow pilot with one application and one model moves faster than a multi-team rollout. Ask for a written scope with stated milestones before work starts, and agree on the exit criteria for the compatibility test.

What must our team provide before a pilot can start?

Your team needs to provide the working inputs that shape the build. These include the accelerator capacity and where it runs, network segments and an isolated place for the server, the list of model weights and their approved sources, the client applications and tools to test, and sample prompts and expected outputs from real use. You also need named owners for identity and API keys, access to logging and metrics, and a decision on who signs off on the results. Confirm with your security team how endpoints will be exposed before the pilot begins, because that decision affects the design.

Can our own team do this without a partner?

A capable platform team can do the work alone if it has GPU operations experience, familiarity with model serving and time to run structured tests. The harder parts are usually the compatibility test design, the exposure controls and the evidence your compliance team asks for. Ask yourself whether the team has someone who can own the test plan, someone who can operate the server, and capacity to repeat tests after each release. A partner can take on any of these as fixed-scope work, with the scope and deliverables agreed in writing before the engagement starts.

How do vLLM upgrades change the Anthropic endpoint, and what should we retest?

Upgrades can change response details, streaming behavior and supported features, so every version change needs a retest. vLLM ships new minor releases about every two weeks, for example v0.30.0 on September 22 and v0.31.0 on October 5, 2026, so a fixed schedule matters. Pin the version you tested, review the release notes for changes to the messages endpoint, and rerun your saved compatibility cases against the candidate build before rollout. Keep the previous version available so you can roll back if a client breaks.

How DeployOpen works on this

DeployOpen plans and implements self-hosted vLLM inside infrastructure you control, including the /v1/messages and token counting endpoints for clients written against the Anthropic Messages API. We start from the tools that will call the endpoint, test them against your models, and document what works and what needs a change before anything is pointed at production.

How we scope

  • We inventory the Anthropic-style clients, SDK versions and internal tools that will call the endpoint.
  • We confirm which models, hardware and vLLM release the written scope will cover.
  • The fixed-scope agreement lists endpoints, compatibility tests, access controls and deliverables before work starts.

How we build

  • We deploy vLLM in your environment and expose only the endpoints users need behind your reverse proxy.
  • We run compatibility tests for messages, streaming, tool use and token counting against your chosen model.
  • We record gaps between the Anthropic-style behavior and what your models return, with a documented workaround for each.

How we hand over

  • You receive the deployment configuration, proxy allowlist, test suite and results in a written handover document.
  • Runbooks cover how to restart the server, rotate keys, change the served model and roll back a release.
  • Your team walks through the compatibility matrix so it can rerun the tests after each vLLM upgrade.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Retainers can cover retesting each vLLM minor release before your clients move to it.
  • We confirm support terms, response expectations and included work in the written agreement, not in general terms.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.