API Key Setup
Updated May 29, 2026, 12:30 PM
API Key Setup
API Key Setup
All ChainGPT API products require an API key for authentication. This page walks through obtaining a key, configuring it for use with the plugin, and managing your credit balance.
Getting an API key
- Visit app.chaingpt.org and connect a crypto wallet to create an account.
- Navigate to API Keys and click Create New Secret Key.
- Copy the key immediately — it is only displayed once.
- Store it securely using an environment variable or secret manager.
Configuring the key
Environment variable (recommended)
Set the CHAINGPT_API_KEY environment variable in your shell:
export CHAINGPT_API_KEY="your-key-here"
Add this to your .bashrc, .zshrc, or .env file so it persists across sessions.
Plugin installs
If you installed via /plugin install, the MCP server reads CHAINGPT_API_KEY from your environment automatically via the .mcp.json configuration:
{
"mcpServers": {
"chaingpt": {
"command": "node",
"args": ["${CLAUDE_PLUGIN_ROOT}/mcp-server/dist/index.js"],
"env": {
"CHAINGPT_API_KEY": "${CHAINGPT_API_KEY}"
}
}
}
}
Manual installs
If you installed via git clone, set the key in your .claude/settings.json MCP server configuration (see Installation).
Loading credits
API calls consume credits. To load credits:
- Visit app.chaingpt.org/addcredits.
- Choose a payment method: crypto (USDT, USDC, ETH, BNB, TRX, $CGPT) or credit card.
- 1,000 credits costs $10 USD (1 credit = $0.01).
- Pay with $CGPT tokens for a 15% bonus on every purchase.
Credits never expire.
Verifying your setup
Test that your key works by asking Claude to check your credit balance (requires the MCP server):
"Check my ChainGPT credit balance"
Or test manually with cURL:
curl -s -o /dev/null -w "%{http_code}" \
-X GET "https://api.chaingpt.org/nft/get-chains?testNet=false" \
-H "Authorization: Bearer $CHAINGPT_API_KEY"
A 200 response means your key is valid. A 401 means the key is invalid or expired — regenerate it from the dashboard.
Common issues
Key not found: Ensure there are no trailing whitespace characters or newlines in the key value. Check with: echo -n $CHAINGPT_API_KEY | wc -c
Wrong header format: The Authorization header must use the Bearer prefix: Authorization: Bearer <key>. Not Token <key> or just the raw key.
Insufficient credits: HTTP 402 or 403 responses indicate your credit balance is too low. Top up at app.chaingpt.org/addcredits.
API authentication details
All ChainGPT API products share the same authentication mechanism:
| Setting | Value |
|---|---|
| Base URL | https://api.chaingpt.org |
| Auth header | Authorization: Bearer <API_KEY> |
| Rate limit | 200 requests/minute per key |
| Content type | application/json for POST requests |