all docs
/ integrations

Anthropic integration

Call Anthropic through the ACE gateway: endpoint, zero-trust credential headers, stored-key alternative and runnable examples.

Send Anthropic traffic to https://engine.acefleet.dev/anthropic/v1/messages with your ACE developer key in Authorization: Bearer ace_dev_... and the provider credential on the zero-trust headers below. The request body is the vendor's own, relayed as written, and the vendor's answer comes back verbatim.

The same headers also serve:

  • https://engine.acefleet.dev/anthropic/v1/messages/count_tokens

Zero-trust headers

Header Required What it carries
x-ace-anthropic-key yes Upstream Anthropic key. Used for this call only, held in memory.

Stored key instead

A stored anthropic vendor key replaces x-ace-anthropic-key. The same surface also serves Claude on Vertex: pin x-ace-provider: google_vertex and send the Vertex credential set instead — see Google Vertex AI below, which shows the call.

Example request

curl -X POST https://engine.acefleet.dev/anthropic/v1/messages \
  -H "Authorization: Bearer ace_dev_<your-dev-key>" \
  -H "x-ace-anthropic-key: sk-ant-..." \
  -H "Content-Type: application/json" \
  -d '{ "model": "claude-sonnet-4-5", "max_tokens": 1024,
        "messages": [{ "role": "user", "content": "ping" }] }'

Quickstarts

Anthropic proxy (cURL)

curl -X POST https://engine.acefleet.dev/anthropic/v1/messages \
  -H "Authorization: Bearer ace_dev_<your-dev-key>" \
  -H "x-ace-anthropic-key: sk-ant-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 1024,
    "messages": [{ "role": "user", "content": "Optimize GPU allocations." }]
  }'

Vercel AI SDK: Anthropic (@ai-sdk/anthropic)

apiKey is sent as x-api-key. The shim treats an ace_dev_ value there as your ACE identity and fills Authorization: Bearer with it when you set none; any other value is a pass-through Anthropic key. So the dev key goes in apiKey and the vendor key on x-ace-anthropic-key — or, equivalently, the vendor key in apiKey and Authorization: Bearer ace_dev_… in headers. Thinking, tools, images and cache_control are relayed as sent; the reply and its stream are Anthropic's own. Token counting is a plain POST of the same body and headers to /anthropic/v1/messages/count_tokens, which returns the vendor's count.

import { createAnthropic } from '@ai-sdk/anthropic';

const anthropic = createAnthropic({
  baseURL: 'https://engine.acefleet.dev/anthropic/v1',
  apiKey: 'ace_dev_<your-dev-key>',                 // sent as x-api-key: your ACE identity
  headers: { 'x-ace-anthropic-key': 'sk-ant-...' }, // zero-trust: used for this call only
});
// model: anthropic('claude-sonnet-4-5')