Connecting Your Anthropic Account via API or OAuth
Table of Contents
This guide shows you how to connect your Anthropic account to an Agento agent so it can use Claude models like Claude Sonnet 4.5 and Claude Opus 4. You can connect via OAuth (recommended) or by pasting an API key.
Prerequisites
Before you start, make sure you have:
- An Agento account with at least one agent created
- An Anthropic account at console.anthropic.com
If using the API key method, you'll also need a funded API key (free-tier keys work but have lower rate limits).
Option A: Connect via OAuth (Recommended)
OAuth lets you connect your Anthropic account without managing API keys โ authentication happens through the browser and tokens refresh automatically.
- Open the Agento dashboard and click on your agent
- Go to the Settings tab
- Under AI Provider, select Anthropic
- Click Connect with Anthropic
- A browser window will open โ log in to your Anthropic account and authorize access
- After authorizing, you'll see a page with a code. Copy the code shown on the page, or copy the entire URL from your browser's address bar
- Paste the code or URL back in Agento and click Complete Connection
The settings page will show a green "Connected" indicator once done.
Why OAuth?
- No key to copy/paste โ authentication happens through the browser
- Automatic refresh โ Agento refreshes your token before it expires
- Revocable โ disconnect at any time from your agent settings or from your Anthropic account
- Works with Claude Pro/Team subscriptions โ no separate API billing needed
Option B: Connect via API Key
If you prefer using an API key:
Get Your API Key
- Log in to console.anthropic.com
- Navigate to API Keys in the left sidebar
- Click Create Key
- Give it a descriptive name like "Agento Agent"
- Copy the key โ you won't be able to see it again
Keep your API key secure. Never share it publicly or commit it to version control.
Add the Key to Your Agent
- Open the Agento dashboard and click on your agent
- Go to the Settings tab
- Under AI Provider, select Anthropic
- Paste your API key into the API Key field
- Click Save
Agento encrypts your key at rest and never exposes it in the UI after saving.
Choose a Model
After connecting (via either method), select the model your agent should use:
| Model | Best For |
|---|---|
| Claude Sonnet 4.5 | Balanced speed and quality for most tasks |
| Claude Opus 4 | Complex reasoning and long-form content |
| Claude Haiku 3.5 | Fast responses and simple tasks |
You can change the model at any time without reconnecting.
Switching Between Methods
You can switch between OAuth and API key at any time from the Settings tab:
- If connected via OAuth, click Use API Key Instead to switch
- If connected via API key, click Switch to OAuth to switch
Only one method can be active at a time.
Verify the Connection
Start your agent (or restart it if it was already running). Open the web chat or send a message through Telegram. If the agent responds, your Anthropic connection is working.
Disconnecting
To disconnect Anthropic:
- Go to your agent's Settings tab
- Click Disconnect (for OAuth) or Remove Key (for API key)
- The agent will stop using Anthropic and you'll need to configure a different provider
Troubleshooting
OAuth window doesn't open: Make sure pop-ups are allowed for agento.host in your browser.
"Authorization failed" error: Try signing out of Anthropic in your browser first, then retry the OAuth flow.
Agent shows "credential error" (API key): Double-check that you copied the full API key including the sk-ant- prefix.
Agent responds slowly or times out: Your Anthropic account may have hit rate limits. Check your usage at console.anthropic.com/settings/usage.
Agent won't start: Make sure your Anthropic account has billing set up. API keys without a payment method may be restricted.