# Anthropic (https://www.librechat.ai/docs/configuration/pre_configured_ai/anthropic)

- Create an account at **[https://platform.claude.com/](https://platform.claude.com/)**
- Go to **[https://platform.claude.com/settings/keys](https://platform.claude.com/settings/keys)** and get your api key
- You will need to set the following environment variable to your key or you can set it to `user_provided` for users to provide their own.

```bash filename=".env"
ANTHROPIC_API_KEY=user_provided
```

- You can determine which models you would like to have available with `ANTHROPIC_MODELS`.

```bash filename=".env"
ANTHROPIC_MODELS=claude-fable-5-1,claude-fable-5,claude-opus-5,claude-opus-4-8,claude-opus-4-7,claude-sonnet-5,claude-sonnet-4-6,claude-opus-4-6,claude-opus-4-20250514,claude-3-7-sonnet-20250219,claude-3-5-sonnet-20241022,claude-3-5-haiku-20241022
```

**Notes:**

- Claude Fable 5.1 and Fable 5 are included in LibreChat's default Anthropic model catalog. Fable/Mythos-class models use the modern Anthropic profile in LibreChat: 1M context, 128K max output, adaptive thinking, prompt caching, and `thinkingDisplay` support for summarized or omitted reasoning output. Fable 5.1 keeps Fable 5's $10 input and $50 output rates per million tokens, with $12.50 cache writes and $0.25 cache reads.
- Claude Opus 5 is available through direct Anthropic, Anthropic on Vertex AI, and AWS Bedrock. It has a 1M-token context window and 128K-token maximum output. Adaptive thinking is enabled unless explicitly disabled; when disabled, LibreChat limits `xhigh` or `max` effort to `high` to keep requests valid.
- Claude Sonnet 5 is available through direct Anthropic, Anthropic on Vertex AI, and AWS Bedrock. LibreChat assigns it a 1M-token context window and 128K-token maximum output, uses adaptive thinking with summarized display when thinking is enabled, and sends an explicit disabled setting when a user turns thinking off.
- Native Anthropic prompt-cache controls and 1M-context detection evaluate the configured Claude model ID directly. Compatible Sonnet and Opus IDs at version 4.6 or later, including matching later-version IDs, retain those controls without waiting for an exact catalog entry. Unsupported models keep prompt-cache controls hidden in the Agent Builder.
- Anthropic endpoint supports all [Shared Endpoint Settings](/docs/configuration/librechat_yaml/object_structure/shared_endpoint_settings) via the `librechat.yaml` configuration file, including `streamRate`, `headers`, `titleModel`, `titleMethod`, `titlePrompt`, `titlePromptTemplate`, and `titleEndpoint`
- To configure Anthropic or an Anthropic-compatible gateway as a separate custom endpoint, use [`provider: "anthropic"`](/docs/configuration/librechat_yaml/object_structure/custom_endpoint#provider).

---

## Vertex AI

LibreChat supports running Anthropic Claude models through **Google Cloud Vertex AI**. This is useful if you:

- Already have Google Cloud infrastructure
- Want to use your existing GCP billing and credentials
- Need to comply with regional data residency requirements

### Quick Setup (Environment Variables)

Set the following environment variables to enable Anthropic via Vertex AI:

```bash filename=".env"
# Enable Vertex AI mode for Anthropic
ANTHROPIC_USE_VERTEX=true

# Vertex AI region (optional, defaults to 'us-east5')
# Modern models such as Fable 5.1 and Opus 5 require global, us, or eu.
# Specific regions serve Sonnet 4.6 and earlier.
ANTHROPIC_VERTEX_REGION=global

# Path to Google service account key file (optional)
# If not specified, uses default path: api/data/auth.json
GOOGLE_SERVICE_KEY_FILE=/path/to/service-account.json
```

### Prerequisites

1. **Google Cloud Project** with Vertex AI API enabled
2. **Service Account** with the following roles:
   - `Vertex AI User` (`roles/aiplatform.user`)
   - Or `Vertex AI Administrator` for full access
3. **Claude models** enabled in your Vertex AI Model Garden
4. **Service Account Key** (JSON file) downloaded and accessible to LibreChat

### Advanced Configuration

For model name mapping and advanced settings (similar to Azure OpenAI configuration), use the `librechat.yaml` file:

```yaml filename="librechat.yaml"
endpoints:
  anthropic:
    vertex:
      region: global
      models:
        claude-fable-5-1:
          deploymentName: claude-fable-5-1
        claude-opus-5:
          deploymentName: claude-opus-5
        claude-sonnet-5:
          deploymentName: claude-sonnet-5
        claude-3.5-haiku:
          deploymentName: claude-3-5-haiku@20241022
```

For detailed YAML configuration options, see [Anthropic Vertex AI Configuration](/docs/configuration/librechat_yaml/object_structure/anthropic_vertex).
