Home / Docs
Anthropic API docs: the Anthropic API documentation for the Claude API gateway
The Anthropic API, documented for the AI Prime Tech gateway: the same Messages API and model ids, one base URL and one key — from a first curl to production hardening. Every current Claude model is served.
curl https://claudeapikey.dev/v1/messages -H "x-api-key: $ANTHROPIC_API_KEY" -H "anthropic-version: 2023-06-01" -H "content-type: application/json" -d '{"model": "claude-sonnet-5", "max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, Claude"}]}'
Get started in four steps
- Create an account and generate an API key in the dashboard.
- Set
ANTHROPIC_BASE_URLto the gateway host andANTHROPIC_API_KEYto your key — the SDK appends/v1/messagesitself. - Send a request in the Anthropic format (
/v1/messages) or the OpenAI format (/v1/chat/completions). - Pick a model id from
GET /v1/models; switch models by changing one string.
QuickstartFirst request in about a minuteClaude CodeTwo environment variablesModelsIds, context windows, ratesAPI referenceEndpoints and schemas
Getting started
IntroductionWhat AI Prime Tech is, which endpoints it speaks, and how it differs from calling Anthropic directly.QuickstartGet a key, set two environment variables, and make your first request in about a minute.AuthenticationHow to send your key, which header each format expects, and how to keep keys safe.Models and key groupsCheck the models available to your API key, choose the right group, and find current model pricing.Base URLsThe one setting that trips everyone up: which URL each client expects, with and without the /v1 suffix.Your first request explainedA line-by-line walkthrough of one Messages call — what every field does and what comes back.
API reference
API overviewEvery endpoint the gateway exposes, which format it speaks, and what it returns.Messages APIPOST /v1/messages — the Anthropic-format endpoint: parameters, response shape and examples.Chat Completions APIPOST /v1/chat/completions — the OpenAI-format endpoint, for Cursor, LangChain, LiteLLM and the OpenAI SDKs.Models endpointGET /v1/models — discover exactly which model ids your key can call.StreamingServer-sent events in both formats — the event shapes differ, and mixing them up reads as silence.ErrorsEvery status code the gateway returns, what actually causes it, and the fix.Rate limitsHow throttling works, what a 429 means here, and how to build a client that does not trigger one.Tool use and function callingLet a model call your functions — the request loop, both formats, and the mistakes that cost tokens.Vision and image inputSend images to multimodal models — encoding, size limits, and what it costs.
Integration guides
Claude CodePoint Anthropic's CLI agent at the gateway with two environment variables — and avoid the one trap that silently bills the wrong key.CursorUse Claude models inside Cursor through the OpenAI-compatible endpoint, without an Anthropic account.ClineConfigure the Cline VS Code extension against the Anthropic-format endpoint.AiderRun the terminal pair-programmer against the gateway in either wire format.ZedAdd the gateway as a custom assistant provider in the Zed editor.ContinueConfigure the Continue extension for VS Code and JetBrains.VS Code extensionsWhich VS Code AI extensions accept a custom base URL, and how to point each at the gateway.JetBrains IDEsIntelliJ IDEA, PyCharm, WebStorm, GoLand and the rest — via Continue or an OpenAI-compatible plugin.OpenCodePoint the open-source terminal coding agent at the gateway.Codex CLIRun OpenAI's Codex CLI and the Codex IDE extension against the gateway, with GPT or Claude models.OpenClawConfigure the OpenClaw agent framework to use gateway models.MCP servers for Claude CodeA Model Context Protocol config that earns its place, plus the traps that cost real time.API key configuration by toolSelect the right key group, then use the key and base URL required by your client.
Working with the API
Cost controlWhere the tokens actually go in an agentic workload, and the four levers that move the bill.Prompt cachingRe-read a stable prefix at a fraction of the input price — what to cache, what not to, and how to verify it worked.Context managementWhy long sessions get expensive non-linearly, and the patterns that keep history bounded.Migrating from the Anthropic APIMove an existing Anthropic-SDK codebase over by changing two values.Migrating from the OpenAI APIKeep the OpenAI SDK and reach Claude models by changing the base URL.Production best practicesWhat to get right before an integration carries real traffic.TroubleshootingSymptom-first index — find what you are seeing and jump to the cause.
SDKs
SDKs overviewOfficial Anthropic and OpenAI SDKs both work unmodified — pick by which format you prefer.PythonWorking examples with the anthropic and openai packages, including streaming and async.TypeScriptNode examples with @anthropic-ai/sdk and openai, including streaming.cURLDependency-free examples for every endpoint — useful for debugging and CI checks.GoCall the gateway from Go with the standard library — no third-party client needed.
Billing
PricingHow credits convert to tokens, what the bonuses are, and how to work out the cost of a task.CreditsHow the prepaid balance works, what draws it down, and how to avoid running dry mid-run.Unlimited plansFlat-rate access for a fixed window — what they include and when they beat credits.Payment methodsCard and crypto — which to use, and why the bonus differs.Refunds and supportWhat can be refunded, what cannot, and how to raise a billing issue.
Resources
FAQDirect answers to the questions we are actually asked.GlossaryThe terms used throughout these docs, defined precisely.Security and privacyHow to handle keys, what to avoid sending, and the boundaries of this service.ChangelogNotable changes to the API surface, models and documentation.Status and reliabilityHow the gateway handles upstream failures, and what to do when something is degraded.Availability and payment methodsWhere the service can be used, and how to pay when card networks are unavailable.
Learn
Buyer-focused explainers that sit alongside the technical docs.
What an Anthropic-Compatible API MeansAnthropic Python SDK: Install, base_url, Streaming, Async and Error Handling (2026)Buy Claude API Credits: Top-Up and Setup GuideThe Cheapest Way to Use the Claude APIClaude Server Error? Every Claude API Error Explained — 400, 429 Rate Limit, 500, 529 Overloaded, and How to Fix EachFree Claude API Key? What's Actually Free — Claude Free API, Trial Credits and the Cheapest Real Option (2026)Claude API Integration Guide: SDKs, REST & Production PatternsClaude Models Explained 2026 — Claude Model Comparison: Claude Opus vs Sonnet vs Haiku vs Fable, Anthropic Model Names & PricesClaude API Pricing ExplainedClaude API Gateway vs. Anthropic DirectClaude API vs Claude Pro/Max Subscription — Which to ChoosePaying for the Claude API with CryptoClaude API Access Without a WaitlistClaude Code Pricing Explained: API Costs, Plans & How to Cut ThemClaude Code API Key (2026) — ANTHROPIC_API_KEY: How to Get It, claude setup-token, OAuth Token vs Session KeyClaude Code API: How Keys, Base URLs & Billing Work (2026)How to Get Unlimited Claude Usage: Plans and LimitsHow to Get a Claude API Key: Console and Gateway SetupHow to Reduce Claude Token UsageOpenAI-Compatible Claude API: Use Claude with the OpenAI SDK (base_url, Streaming, Tools) (2026)Hermes Agent with Claude on Your Own API: Custom Provider config.yaml and Cost Controls (2026)Running Unlimited OpenClaw on ClaudeUnlimited Claude API: Coverage and Fair-Use LimitsUnlimited Claude API key: plans, setup and limits
Codex and GPT API guides: Codex API key and access · OpenAI-compatible API · Codex CLI setup · GPT-6 model comparison