> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gourmand.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Configure Anthropic Claude Models with Gobi

<Tip>
  **Discover Anthropic models [here](https://hub.gourmand.dev/anthropic)**
</Tip>

<Info>
  Get an API key from the [Anthropic Console](https://console.anthropic.com/account/keys)
</Info>

## Configuration

<Tabs>
  <Tab title="YAML">
    ```yaml title="config.yaml" theme={null}
    models:
      - name: <MODEL_NAME>
        provider: anthropic
        model: <MODEL_ID>
        apiKey: <YOUR_ANTHROPIC_API_KEY>
    ```
  </Tab>

  <Tab title="JSON (Deprecated)">
    ```json title="config.json" theme={null}
    {
      "models": [
        {
          "title": "<MODEL_NAME>",
          "provider": "anthropic",
          "model": "<MODEL_ID>",
          "apiKey": "<YOUR_ANTHROPIC_API_KEY>"
        }
      ]
    }
    ```
  </Tab>
</Tabs>

<Info>
  **Check out a more advanced configuration [here](https://hub.gourmand.dev/anthropic/claude-4-sonnet?view=config)**
</Info>

## How to Enable Prompt Caching with Claude

Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching), which allows Claude models to cache system messages and conversation history between requests to improve performance and reduce costs.

To enable caching of the system message and the turn-by-turn conversation, update your model configuration as follows:

<Tabs>
  <Tab title="YAML">
    ```yaml title="config.yaml" theme={null}
    models:
      - name: <MODEL_NAME>
        provider: anthropic
        model: <MODEL_ID>
        apiKey: <YOUR_ANTHROPIC_API_KEY>
        roles:
          - chat
        defaultCompletionOptions:
          promptCaching: true
    ```
  </Tab>

  <Tab title="JSON (Deprecated)">
    ```json title="config.json" theme={null}
    {
      "models": [
        {
          "cacheBehavior": {
            "cacheSystemMessage": true,
            "cacheConversation": true
          },
          "title": "<MODEL_NAME>",
          "provider": "anthropic",
          "model": "<MODEL_ID>",
          "defaultCompletionOptions": {
            "promptCaching": true
          },
          "apiKey": "<YOUR_ANTHROPIC_API_KEY>"
        }
      ]
    }
    ```
  </Tab>
</Tabs>
