Setup guides
Switching an existing integration to a different billing route is usually a base URL change, not a rewrite. These walk through it tool by tool.
Claude Code
Two environment variables, verification via curl, and the four errors people actually hit.
Cursor
Where the base URL override lives, and how to confirm requests are routing.
OpenAI & Anthropic SDK
One base_url argument. Python, Node and curl examples.
Base URL in Node.js
OpenAI and Anthropic SDKs from Node: the capitalisation trap, doubled paths and a dependency-free fetch version.
Gemini through a custom endpoint
Use one client across vendors, and read the exact model ID off /models.
Using Claude inside your tools
Claude API in Cursor
Add your own key, override the base URL, and pick a model per task.
Anthropic base URL in Python
Sync, streaming, async and raw HTTP examples — plus the headers that cause most 401s.
Migrate from OpenAI to Claude
Request/response mapping table, tool calling differences, and a shadow-mode cutover plan.
Claude in LangChain
Set the endpoint on the chat model; chains, agents and parsers stay unchanged.
Cost control
Claude Code cost per month
What actually drives the bill — and why it is usually context resends, not message count.
Reduce Claude API cost
Eight levers ranked by effect, with code for the two that matter most.
OpenAI-compatible endpoints
Which parts of the contract are portable, and the three features that are not.
Monitor API spend
Log usage per request, attribute it, and alert on change rather than totals.
Batch API vs realtime rates
What the 50% batch discount and 10% cached-input rate really buy — and when waiting 24 hours saves nothing.
Operations and troubleshooting
API error troubleshooting
401, 404, 429 and 529 — what each actually means and the exact fix.
Rate limits explained
Three axes enforced per model, correct backoff, and why parallelism causes most throttling.
Cursor API key errors
Own-key failures diagnosed: restart behaviour, doubled paths, quota that will not move.
Before you start
- Generate an API key from your gateway dashboard and copy the base URL.
- Run a single curl request before you migrate any real traffic.
- Keep the base URL in an environment variable so switching back is instant.