API Key Setup Guide
Learn how to obtain and configure API keys from Anthropic and OpenAI
Overview
KashKlaw requires API keys to enable OpenClaw's AI capabilities. You can configure keys from:
- Anthropic - For Claude models (Claude 3.5 Sonnet, Claude 3 Opus, etc.)
- OpenAI - For GPT models (GPT-4, GPT-3.5, etc.)
You need at least one API key configured, but you can add both providers to give users more model choices.
Obtaining Anthropic API Keys
Step 1: Create an Anthropic Account
Visit console.anthropic.com and sign up for an account. You'll need to verify your email and add billing information (Anthropic charges per token usage).
Step 2: Generate an API Key
- From the Anthropic console, navigate to "API Keys" in the left sidebar
- Click "Create Key"
- Give your key a descriptive name (e.g., "KashKlaw Production")
- Copy the key immediately - it will only be shown once
Warning: Store your API key securely. Never commit it to version control or share it publicly.
Step 3: Add to KashKlaw Dashboard
- Go to your KashKlaw dashboard
- Find the "API Keys" section or "Settings" area
- Paste your Anthropic API key in the "Anthropic API Key" field
- Click "Save" or "Update Keys"
- If you already have an instance running, restart it for the changes to take effect
Obtaining OpenAI API Keys
Step 1: Create an OpenAI Account
Visit platform.openai.com and sign up for an account. You'll need to add a payment method to use the API (OpenAI charges per token usage).
Step 2: Navigate to API Keys
From the OpenAI platform dashboard, click your profile icon in the top right, then select "View API Keys" or navigate directly to the API keys section.
Step 3: Generate and Copy Key
- Click "Create new secret key"
- Give your key a name (e.g., "KashKlaw")
- Copy the key immediately - it will only be shown once
- Store it securely
Step 4: Add to KashKlaw Dashboard
- Go to your KashKlaw dashboard
- Find the "API Keys" section or "Settings" area
- Paste your OpenAI API key in the "OpenAI API Key" field
- Click "Save" or "Update Keys"
- If you already have an instance running, restart it for the changes to take effect
Security Best Practices
- Encryption at rest - KashKlaw encrypts your API keys in our database using industry-standard encryption
- Isolated access - Your API keys are only accessible to your instance, never to other users or instances
- Never share keys - Treat API keys like passwords. Don't share them via email, chat, or public channels
- Rotate regularly - We recommend rotating your API keys every 90 days
- Monitor usage - Check your Anthropic/OpenAI dashboards regularly for unexpected usage
- No version control - Never commit API keys to Git, GitHub, or any version control system
If you believe your API key has been compromised, revoke it immediately in your provider's console (Anthropic or OpenAI) and generate a new one.
Model Selection
If model selection is enabled, you can choose which AI model your instance uses from the AI Models page in your dashboard. Your selected model is configured automatically in your instance.
Changing your model requires an active subscription. The model you select determines which API key is needed — Anthropic keys for Claude models, OpenAI keys for GPT models.
Updating API Keys
You can update your API keys anytime from your KashKlaw dashboard:
- Go to your dashboard
- Navigate to the Settings or API Keys section
- Update the key field(s) with your new API key(s)
- Click "Save" or "Update Keys"
- Restart your instance for changes to take effect
You do not need to redeploy your instance to update API keys. Saving new keys will automatically update your running machine with the new configuration.
Troubleshooting
"Invalid API Key" Error
- Check for extra spaces or characters when copying the key
- Verify the key hasn't been revoked in your provider's console
- Ensure your provider account has billing set up and sufficient credits
- Try generating a new key and updating it in KashKlaw
- Restart your instance after updating keys
Models Not Appearing in OpenClaw
- Confirm the corresponding API key is configured (Anthropic for Claude, OpenAI for GPT)
- Restart your instance after adding new keys
- Check that the API key has access to the models you expect
Need More Help?
Contact our support team if you're still experiencing issues with API key configuration.