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

# Proxy Setup

> Configure the MeshAI proxy for your agents

## 1. Create a Proxy Key

<Steps>
  <Step title="Go to Settings">
    Navigate to [app.meshai.dev/settings](https://app.meshai.dev/settings) → Proxy Keys tab.
  </Step>

  <Step title="Create Key">
    Click "Create Proxy Key" and provide:

    * **Label**: descriptive name (e.g., "production-claude-code")
    * **Allowed models** (optional): restrict which models this key can use
    * **Budget limit** (optional): monthly spend cap in USD
  </Step>

  <Step title="Copy Key">
    Copy the proxy key (`msh_...`). It's shown once. Save it securely.
  </Step>
</Steps>

## 2. Configure Your Agent

### Method A: URL-Embedded Key (Simplest)

Embed the key in the base URL. Works with tools that can't set custom headers:

```bash theme={null}
# Anthropic (e.g., Claude Code)
export ANTHROPIC_BASE_URL=https://proxy.meshai.dev/v1/anthropic/k/msh_YOUR_KEY

# OpenAI (e.g., Codex, Cline)
export OPENAI_BASE_URL=https://proxy.meshai.dev/v1/openai/k/msh_YOUR_KEY
```

### Method B: Header-Based Key

Set the `X-MeshAI-Key` header and override the base URL:

```bash theme={null}
export ANTHROPIC_BASE_URL=https://proxy.meshai.dev/v1/anthropic
# Then in your code, add header: X-MeshAI-Key: msh_YOUR_KEY
```

## 3. Verify

Make a request through your agent. Check the dashboard. You should see:

* The agent appear in the Registry
* Token usage in the Cost tab
* Request count in the Dashboard

## Budget Limits

If you set a budget limit on the proxy key, requests are blocked when the monthly spend exceeds the limit:

```json theme={null}
{"error": "Monthly budget limit exceeded for this proxy key"}
```

## Managed Provider Keys

For enterprise deployments, MeshAI can manage your provider API keys via AWS Secrets Manager. This means agents never see the raw provider key. MeshAI injects it at the proxy layer.

Configure in Settings → Managed Keys.
