PicoClaw is an ultra-lightweight AI assistant that can run on hardware costing just $10, with a memory usage of less than 10MB. This guide will introduce how to configure the Claude API for PicoClaw.
Introduction
PicoClaw supports several methods for accessing the Claude API:
- Defapi Platform (Recommended): Half-price discount, supports all models of Claude
- Official Anthropic API: Direct connection to the official service
- OpenRouter: Access via a third-party router
- Claude CLI: Local use without an API Key
Method 1: Defapi (Recommended)
Defapi is an AI API aggregation platform, with prices only half of the official rates, making it ideal for individual developers and small projects.
1. Obtain Defapi API Key
- Visit Defapi Official Website to register an account
- Get your API Key in your personal dashboard
2. Configure PicoClaw
Edit the configuration file ~/.picoclaw/config.json:
{
"agents": {
"defaults": {
"model": "anthropic/claude-sonnet-4-5-20250929"
}
},
"providers": {
"openrouter": {
"api_key": "yourDefapi-Key",
"api_base": "https://api.defapi.org"
}
}
}
3. Supported Claude Models
| Model | Configuration Name |
|---|---|
| Claude Opus 4.6 | anthropic/claude-opus-4-6 |
| Claude Sonnet 4.5 | anthropic/claude-sonnet-4-5-20250929 |
| Claude Haiku 4.5 | anthropic/claude-haiku-4-5-20251001 |
4. Advantages of Defapi
- Half-price discount: 50% lower than official prices
- No VPN needed: Can be accessed directly within the country
- Stable and fast: Enterprise-grade stable service
- Good compatibility: Compatible with OpenAI v1/chat/completions protocol
Method 2: Official Anthropic API
1. Obtain API Key
- Visit Anthropic Console
- Create your API Key
2. Configure PicoClaw
{
"agents": {
"defaults": {
"model": "claude-sonnet-4-5-20250929"
}
},
"providers": {
"anthropic": {
"api_key": "sk-ant-api03-xxx"
}
}
}
Method 3: OpenRouter
1. Obtain API Key
Visit OpenRouter to obtain your API Key.
2. Configure PicoClaw
{
"agents": {
"defaults": {
"model": "anthropic/claude-opus-4-6"
}
},
"providers": {
"openrouter": {
"api_key": "sk-or-v1-xxx"
}
}
}
If you need a proxy:
{
"providers": {
"openrouter": {
"api_key": "sk-or-v1-xxx",
"proxy": "http://127.0.0.1:7890"
}
}
}
Method 4: Claude CLI (Local)
If you have installed the Claude Code CLI, you can use the local CLI without an API Key.
Configuration
{
"agents": {
"defaults": {
"provider": "claude-cli",
"model": "claude-sonnet-4-5-20250929"
}
}
}
Verify if PicoClaw is Working
Method 1: Direct Message Testing
# Navigate to PicoClaw directory
cd picoclaw
# Test if Claude is functioning properly
picoclaw agent -m "Hello, please reply with hello"
If a normal response is returned, the configuration is successful!
Method 2: Start Gateway for Testing
# Start the gateway
picoclaw gateway
# Then send a message for testing through the configured chat channels (Telegram/Discord, etc.)
Method 3: Check Logs
# View PicoClaw logs
docker compose logs -f picoclaw-gateway
Frequently Asked Questions
1. Returns "no API key configured"
Check if the api_key in the configuration file is filled in correctly.
2. Model not supported
Ensure that the model name you are using is correct; you can try using the default model claude-sonnet-4-5-20250929.
3. Network Connectivity Issues
If you need a proxy, add the proxy field in the corresponding provider configuration.