> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fabricgateway.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fabricgateway.ai/_mcp/server.

# Connect Anthropic

> Target URL, credentials, supported endpoints, and model names for an Anthropic connection.

The Anthropic connection sends requests to the Anthropic Messages API with your organization's Anthropic API key. Clients call the route with the Anthropic Messages format, and the gateway forwards each request unchanged, apart from the credentials. This topic lists what's specific to Anthropic. For the setup steps, which use Anthropic as the example, see [Connect an LLM provider](/configure/connections/llm-providers).

## Target URL

Use `https://api.anthropic.com`.

## Credentials

Enter an Anthropic API key when you set up credentials. The gateway sends it to Anthropic in the `x-api-key` header and replaces any `x-api-key` header that the client sent. Callers authenticate to the gateway with their gateway key in `fg-api-key`, which is why the gateway key doesn't use `x-api-key`. For details, see [Authenticate requests with Key Auth](/configure/authentication/key-auth).

Clients must still send the `anthropic-version` header. It reaches Anthropic unchanged, and so does `anthropic-beta`.

## Supported endpoints

| Method | Path                        | Notes               |
| ------ | --------------------------- | ------------------- |
| `POST` | `/v1/messages`              | Supports streaming. |
| `POST` | `/v1/messages/count_tokens` |                     |
| `GET`  | `/v1/models`                |                     |

These three endpoints are all that Claude Code needs. A request to any other path gets `404`. The gateway doesn't translate between API formats, so an OpenAI chat completions request to an Anthropic route fails.

## Model names

The gateway sends the `model` field exactly as the client wrote it, for example `claude-sonnet-4-5`. If the connection restricts models, the name must match an entry on the list exactly. For details, see [Restrict model and tool access](/configure/access-and-limits/model-access).

## Example

```bash
curl "BASE_URL/v1/messages" \
  -H "fg-api-key: GATEWAY_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 256,
    "messages": [{ "role": "user", "content": "Hello" }]
  }'
```

Replace `BASE_URL` with the route's base URL and `GATEWAY_KEY` with your gateway key. For how to find both, see [Authenticate and send a request](/use/authenticate).

## Next steps

* [Call a route with the Anthropic Messages API](/use/llm/anthropic-messages)
* [Use Claude Code with Fabric AI Gateway](/guides/coding-agents/claude-code)
* [Restrict model and tool access](/configure/access-and-limits/model-access)