Editor & CLI integration
Copy-paste setup for the most common clients. Each tool has a tuned route — point your client at the matching prefix and your key works on either subscription or pay-per-token mode.
#Claude Code
Anthropic's CLI. Set two env vars, then run as usual.
export ANTHROPIC_BASE_URL="https://api.powapi.io/claudecode"
export ANTHROPIC_API_KEY="pk_live_xxxxxxxxxxxx"
claude # everything else stays the same#Cline (VS Code)
In Cline settings → API provider, choose Anthropic. Use the Cline-tuned route — your subscription or pay-per-token key works on either:
Provider: Anthropic
Base URL: https://api.powapi.io/cline
API Key: pk_live_xxxxxxxxxxxx#Cursor
Cursor speaks OpenAI by default. In Settings → Models → OpenAI API key, turn on Override OpenAI Base URL and set:
Base URL: https://api.powapi.io/v1
API Key: pk_live_xxxxxxxxxxxxIf you use Cursor with an Anthropic model instead, point at the Cursor-tuned Anthropic route:
Provider: Anthropic
Base URL: https://api.powapi.io/cursor
API Key: pk_live_xxxxxxxxxxxx#Roo Code
Same pattern as Cline — Anthropic provider, Roo Code-tuned base URL:
Provider: Anthropic
Base URL: https://api.powapi.io/roocode
API Key: pk_live_xxxxxxxxxxxx#Anthropic SDK (Python / TypeScript)
The SDK appends /v1/messages to your base URL. Pick the preset that matches your client — or use the bare host for the generic pay-per-token route.
from anthropic import Anthropic
# Subscription key — pick the preset that matches your client.
# Pay-per-token key — point to "https://api.powapi.io" instead.
client = Anthropic(
base_url="https://api.powapi.io/claudecode",
api_key="pk_live_xxxxxxxxxxxx",
)
resp = client.messages.create(
model="auto",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)#OpenAI SDK
The OpenAI Chat Completions route is pay-per-token only. Use a pay_per_token key.
from openai import OpenAI
client = OpenAI(
base_url="https://api.powapi.io/v1",
api_key="pk_live_xxxxxxxxxxxx",
)
resp = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Hello"}],
)#Curl (smoke test)
Two flavors — pick the one matching your key's metering mode:
# Subscription key — works on any tool-tuned route
curl https://api.powapi.io/claudecode/v1/messages \
-H "Authorization: Bearer pk_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"max_tokens": 64,
"messages": [{"role": "user", "content": "Say hi"}]
}'
# Pay-per-token key — generic Anthropic route
curl https://api.powapi.io/v1/messages \
-H "Authorization: Bearer pk_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"max_tokens": 64,
"messages": [{"role": "user", "content": "Say hi"}]
}'