Cookbook Recipe
CLI AgentRun Claude Code on your own balance
Point Anthropic's Claude Code agent at DEVUP AI via ANTHROPIC_BASE_URL and pay for coding sessions directly in Algerian Dinar (DZD).
What you will build
Claude Code is Anthropic's official terminal-based agentic coding tool. By default, it sends requests directly to Anthropic and requires an international credit card.
In this recipe, you will configure Claude Code to route all its API traffic through DEVUP AI's Anthropic Messages adapter. Your agent sessions will execute against Claude models while debiting your local DZD balance with zero currency conversion fees.
Prerequisites
- Node.js 18+ installed on your machine.
- A funded DEVUP AI account with positive balance in DZD.
- A valid DEVUP API key (
sk-devup-...) generated from your dashboard.
Step-by-step setup
1Install the Claude Code CLI
Install the official Claude Code package globally using npm:
npm install -g @anthropic-ai/claude-code2Set the two environment variables
Claude Code honors standard Anthropic client variables. Export ANTHROPIC_BASE_URL to point at DEVUP AI, and pass your DEVUP API key via ANTHROPIC_API_KEY:
export ANTHROPIC_BASE_URL="https://api.devupai.com"
export ANTHROPIC_API_KEY="sk-devup-your-api-key-here"3Select a verified model identifier
Claude Code attempts to use date-stamped aliases by default. On DEVUP AI, you must explicitly specify one of the verified model slugs:
claude-sonnet-4-6Recommended default for software engineering, refactoring, and code generation.
claude-haiku-4-5High speed, cost-effective for quick checks and file searches.
claude-opus-4-7Maximum depth for high-complexity architectural refactors.
4Verify the connection before starting a session
Run this minimal curl call to verify your authentication and model routing against the live API:
curl https://api.devupai.com/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 10,
"messages": [{"role": "user", "content": "Reply with the word VERIFIED."}]
}'5Launch Claude Code
Pass the --model flag or set ANTHROPIC_MODEL so Claude Code selects the verified model slug:
claude --model claude-sonnet-4-6Actual output
Here is the exact response returned by https://api.devupai.com/anthropic/v1/messages for the verification request in Step 4:
{
"id": "msg_devup-sample-msg-id",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-6",
"content": [
{
"type": "text",
"text": "VERIFIED"
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 16,
"output_tokens": 5
}
}Checking your balance & cost transparency
Unlike international platforms with monthly invoices, DEVUP AI deducts strictly per-token directly in DZD.
- The test query above processed 16 input tokens and generated 5 output tokens.
- You can check your remaining balance at any time on the web dashboard or programmatically via the verified balance endpoint:
Live balance endpoint check
curl https://api.devupai.com/v1/user/balance \
-H "Authorization: Bearer $ANTHROPIC_API_KEY"{
"balance_dzd": 500.00
}What to do when it breaks
Observed errors and exact response envelopes returned by the live gateway:
HTTP 401 — Invalid or inactive API key
Triggered if ANTHROPIC_API_KEY is misspelled, has extraneous spaces, or was deleted:
{
"type": "error",
"error": {
"type": "authentication_error",
"message": "The API key provided is invalid or has been deactivated."
}
}Fix: Verify your key in the dashboard under API Keys, re-copy it, and re-export the environment variable.
HTTP 404 — Model not found or unavailable
Triggered if Claude Code is started without --model claude-sonnet-4-6 and defaults to an unmapped date-stamped identifier:
{
"type": "error",
"error": {
"type": "not_found_error",
"message": "The requested model was not found or is unavailable."
}
}Fix: Always pass --model claude-sonnet-4-6 when invoking Claude Code.
Honest limits
- Prompt Caching Breakpoints: Anthropic's experimental client-side cache control breakpoints (
cache_control) are translated into standard chat messages by the adapter layer. - Organization Governance: Features requiring Anthropic Workspace Admin APIs (seat provisioning, custom SCIM) are not proxied.
- When to use direct Anthropic: If your organization requires direct billing in USD under an existing enterprise master agreement with Anthropic PBC.