← Blog

Anthropic Claude API: Setup, Auth, First Call

2026-09-13 · 5 min read · SubToAPI Team

If you're searching for "anthropic claude api," you're likely trying to figure out one of two things: how to get programmatic access to Claude models for your application, or how the API actually works once you have a key. This article covers both — from signing up to sending your first request, plus the practical decisions you'll need to make around authentication, rate limits, and cost.

The short version: the Anthropic Claude API is an HTTPS-based interface that lets developers send prompts to Claude models (Opus, Sonnet, Haiku, depending on version) and get back text, structured tool calls, or streamed responses. You authenticate with an API key, send JSON payloads to a /messages endpoint, and pay per token. It's conceptually similar to the OpenAI API, but with its own request format, message roles, and system prompt handling.

Getting Access to the API

Anthropic offers direct API access through the Anthropic Console, where you create an organization, generate an API key, and add billing. This is separate from a personal Claude.ai subscription — a Pro or Max plan doesn't automatically give you API keys. The console-based API is billed per token, with no monthly seat fee, but no included usage either.

There are a few paths depending on what you already have:

Which path makes sense depends on whether you're building a side project, a small internal tool, or a production feature with real traffic.

The Basic Request Shape

The core of the API is the Messages endpoint. A minimal request looks like this:

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Summarize the plot of Dune in three sentences."}
    ]
  }'

Key things to know about the request structure:

If you're routing requests through SubToAPI instead of calling Anthropic directly, the shape is nearly identical — you just point at a different host and use your sub_live_... key:

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Summarize the plot of Dune in three sentences."}
    ]
  }'

Full request/response details are in the docs, and a step-by-step setup walkthrough is in the quickstart.

Streaming, Tools, and Other Capabilities

The API isn't limited to single-shot text completion. Three features matter most for real applications:

Streaming. Setting "stream": true returns server-sent events so you can render tokens as they arrive, which matters for chat UIs and anything where perceived latency counts. See streaming docs for the event format if you're building against SubToAPI's endpoint.

Tool use. You can define functions (tools) with JSON schemas, and the model will return structured calls to those tools instead of free text when appropriate — useful for anything that needs to query a database, call another API, or perform a calculation. Details are in the tools docs.

Vision and documents. Recent Claude models accept image and PDF content blocks alongside text, so the same endpoint handles multimodal input without a separate API.

Practical Considerations Before You Build

A few things trip up teams new to the Claude API:

  1. Rate limits scale with usage tier, not with your subscription plan. New accounts start with conservative limits that increase as you spend more, which can be a surprise if you're planning a launch.
  2. Token costs vary significantly by model. Larger models cost more per token but may need fewer retries or shorter prompts to get the same result — measure both together, not token price in isolation.
  3. API keys and console access are organization-scoped, so if you're on a team, you'll need a process for provisioning and rotating keys rather than sharing one key across developers.
  4. Usage tracking is per-key, not automatically per-feature or per-customer, so if you're building a product on top of the API, you'll want your own metering layer unless your provider gives you one.

This last point is where a wrapper layer helps: SubToAPI gives each application its own sub_live_... key with usage metadata attached, so you can see consumption per key without building that tracking yourself. Plans start at €9/month for a solo key, up to €49/seat for team and scale usage — see pricing for the breakdown. It's not a replacement for Anthropic's models; it's a way to get API-shaped access without setting up separate console billing for every project.

Getting Started Quickly

If you just want to send your first request today:

  1. Decide whether you're going through Anthropic's console directly, a cloud provider, or a subscription bridge like SubToAPI.
  2. Generate a key and store it as an environment variable — never hardcode it.
  3. Send a test request with a small max_tokens value to confirm auth works before building anything on top.
  4. Add error handling for rate limits (429) and overloaded responses (529) early, since these are common under real traffic.

From there, the quickstart walks through a full working example including streaming and error handling.

Questions

Is the Anthropic Claude API the same as Claude.ai? No. Claude.ai is the consumer chat product with a subscription. The API is a separate, pay-per-token developer product accessed through the Anthropic Console, though both use the same underlying models.

Can I use my Claude Pro or Max subscription for API access? Not directly through Anthropic — API keys require separate console billing. Services like SubToAPI let you generate application API keys from an existing subscription instead.

What's the difference between calling Anthropic directly and using a wrapper API? Calling Anthropic directly gives you the full raw feature set and Anthropic's own billing. A wrapper like SubToAPI adds per-key usage metadata, team seats, and a single dashboard, useful if you're managing multiple apps or don't want separate console accounts for each one.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →