Skip to main content
Craft Agents natively supports Anthropic’s Claude models through the Claude Agent SDK. You can connect using either an API key or by signing in with your Claude Max/Pro subscription.

Connection Methods

API Key

Direct API access with a key from the Anthropic Console

Claude Max/Pro OAuth

One-click sign-in with your Claude subscription

API Key Setup

1

Get your API key

  1. Go to the Anthropic Console
  2. Navigate to API Keys
  3. Click Create Key
  4. Copy your API key (starts with sk-ant-)
Keep your API key secure. Never commit it to version control or share it publicly.
2

Add connection in Craft Agents

  1. Open SettingsAI Connections
  2. Click Add Connection
  3. Select Anthropic (API Key)
  4. Paste your API key
  5. Choose your default model (e.g., claude-sonnet-4.6)
  6. Click Save
3

Verify connection

The connection will be automatically validated. You’ll see a green checkmark when it’s ready to use.

Available Models

Craft Agents automatically detects the latest Claude models available on your API key:
  • Claude Opus 4.6 - Most capable model for complex reasoning
  • Claude Sonnet 4.6 - Balanced performance and speed
  • Claude Haiku 4.5 - Fast model for simple tasks
Older model versions (3.5, 3.0) are also supported if available on your account.

OAuth Setup

Sign in with your existing Claude Max or Claude Pro subscription using browser-based OAuth authentication.
1

Start OAuth flow

  1. Open SettingsAI Connections
  2. Click Add Connection
  3. Select Claude Max / Pro (OAuth)
  4. Click Authenticate with Claude
2

Authenticate in browser

Your browser will open to claude.ai/oauth/authorize.
  1. Sign in with your Claude account
  2. Review the requested permissions:
    • user:inference - Make API calls to Claude models
    • user:profile - Access your account details
    • org:create_api_key - Generate temporary API keys
  3. Click Authorize
3

Complete setup

After authorization, you’ll be redirected to a callback page. Copy the authorization code and paste it back into Craft Agents.
Authorization codes expire after 10 minutes. If you wait too long, you’ll need to restart the flow.

OAuth Implementation Details

Craft Agents uses PKCE (Proof Key for Code Exchange) for secure OAuth without a client secret. This is the recommended flow for desktop applications. OAuth Configuration:
Client ID: 9d1c250a-e61b-44d9-88ed-5944d1962f5e
Auth URL: https://claude.ai/oauth/authorize
Token URL: https://console.anthropic.com/v1/oauth/token
Scopes: user:inference user:profile org:create_api_key
Source: packages/shared/src/auth/claude-oauth-config.ts:8-36
OAuth tokens are stored encrypted using AES-256-GCM in ~/.craft-agent/credentials.enc. They are automatically refreshed when they expire.

Using Claude Agent SDK

All Anthropic connections use the Claude Agent SDK as the backend. This provides:
  • Native tool support - MCP servers, APIs, and built-in tools
  • Streaming responses - Real-time output as Claude thinks
  • Session persistence - Conversation history and context
  • Permission modes - Safe/Ask/Auto approval for tool use
The SDK is configured in packages/shared/src/agent/claude-agent.ts with:
import { Agent } from '@anthropic-ai/claude-agent-sdk';

const agent = new Agent({
  model: 'claude-sonnet-4.6',
  apiKey: process.env.ANTHROPIC_API_KEY,
  mcpServers: [...], // Your connected sources
  tools: [...],      // Session-scoped tools
});
Source: packages/shared/src/agent/claude-agent.ts

Pricing

API pricing is based on input and output tokens. Current rates (as of March 2026):
ModelInputOutputContext Window
Claude Opus 4.6$15/M tokens$75/M tokens200K
Claude Sonnet 4.6$3/M tokens$15/M tokens200K
Claude Haiku 4.5$0.80/M tokens$4/M tokens200K
OAuth connections use the same pricing as API keys. Check anthropic.com/pricing for the latest rates.

Troubleshooting

Error: Authentication failed. Check your API key or OAuth token.Solutions:
  • Verify your API key starts with sk-ant- and has no extra whitespace
  • For OAuth: Sign out and re-authenticate
  • Check that your Claude subscription is active
  • Ensure you have sufficient API credits (for API key connections)
Error: Rate limited or quota exceeded. Try again later.Anthropic enforces rate limits based on your tier:
  • Tier 1 (new accounts): 50 requests/minute
  • Tier 4 (high usage): 2,000 requests/minute
Wait a few minutes and try again. Contact Anthropic support to increase your tier.
Error: Model not found. Check the connection configuration.Some models require special access:

Next Steps

Connect Sources

Add MCP servers, APIs, and data sources

Create Skills

Write custom instructions for specialized tasks

Build docs developers (and LLMs) love