How to connect the Claude API
to your tools

What an AI model's API is, how to get a key and how to connect it to spreadsheets, business software or a small internal script. Explained without assuming anything.

10 minute read · data updated June 2026

Making two programmes talk
without a person in the middle

An API (Application Programming Interface) is a way of making two programmes talk to each other without a human in the middle. When you use Claude via the website or the app, there is a person typing and reading. With the API, it is your software that sends the question and receives the answer: a spreadsheet, a business management system, a script that runs overnight.

The key idea to keep in mind: the API is not a different tool — it is the same "intelligence" without the chat interface. You send text (a message, a document, some data), the model replies with text. Everything else — automations, integrations — is built around that exchange.

Pay as you go,
per "token"

Unlike a monthly subscription, the API is billed on consumption. The unit of measure is the token: a small piece of text, on average about 0.75 words in English (slightly more in Italian, because words tend to be longer). Input tokens (what you send: the prompt, documents, context) and output tokens (the model's reply) are billed separately. Prices are expressed per million tokens (MTok).

As of June 2026 the range consists of three models, from the most economical to the most capable. Base prices per million tokens are:

Model Profile Input Output
Claude Haiku 4.5 Fast and economical, for high volumes $1 / MTok $5 / MTok
Claude Sonnet 4.6 Balanced, good for most tasks $3 / MTok $15 / MTok
Claude Opus 4.8 The most capable, for the hardest tasks $5 / MTok $25 / MTok

To give a sense of scale: summarising a document of a few pages and receiving a short reply typically consumes a few thousand tokens. With Haiku, that works out to fractions of a cent per request. This is why, in SMEs, the cost of the models is almost always the smallest line item compared to people's time.

Tip: start with Haiku 4.5 for testing and high volumes, move to Sonnet 4.6 when quality isn't quite enough, and keep Opus 4.8 for genuinely complex cases. Changing model means changing one line.

Getting
an API key

The API key is a secret string that identifies your account and charges consumption to you. Here is how to get one:

  • Go to the developer console: platform.claude.com and create an account (new accounts receive a small free credit for testing, with no credit card required).
  • In the settings, find the API Keys section and generate a new key.
  • Copy it and store it immediately: it is shown only once. If you lose it, generate a new one.
  • To use it in production, add a payment method and — importantly — set a monthly spending limit in the console. This is your safety net against errors that send requests in an infinite loop.

The key is a password. Treat it as one.

Never write it inside code that ends up in a repository, never paste it into emails, never put it in a shared spreadsheet. It should be stored in an environment variable or a secrets manager. Anyone who has your key can spend your money.

The first
call

Everything goes through a single "address": the messages endpoint, to which you send a request containing the key, the version, the chosen model and the message. Here is the most basic version possible, using curl (the command-line tool available almost everywhere):

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-haiku-4-5",
    "max_tokens": 300,
    "messages": [
      {"role": "user", "content": "Summarise this text in three bullet points: ..."}
    ]
  }'

There are only a few pieces to understand: model selects which model to use; max_tokens caps the length of the reply (and therefore the cost); messages is the conversation, where role: "user" is what you say. The response that comes back contains the model's text and a summary of the tokens consumed.

The same, from a script (C# example)

In a .NET context — a management system, an internal service — the call is a standard HTTP request:

using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-api-key",
    Environment.GetEnvironmentVariable("ANTHROPIC_API_KEY"));
http.DefaultRequestHeaders.Add("anthropic-version", "2023-06-01");

var payload = new {
    model = "claude-sonnet-4-6",
    max_tokens = 500,
    messages = new[] {
        new { role = "user", content = "Extract the date and amount from this text: ..." }
    }
};

var resp = await http.PostAsJsonAsync(
    "https://api.anthropic.com/v1/messages", payload);
var json = await resp.Content.ReadAsStringAsync();

The same pattern applies in Python, JavaScript or any other language: there are also official libraries (SDKs) that spare you from writing the request by hand, but the underlying concept is always the same.

Connecting it
to your tools

To a spreadsheet

The most immediate option for those who do not write code. In Google Sheets you can write a small script (Apps Script) that, for each row, sends the content of a cell to the API and writes the reply into the adjacent cell: useful for classifying, translating or summarising hundreds of rows. In Excel you do the same with a macro or with Office Scripts. It is the quickest way to deliver value without an IT project.

To a business management system

If the management system already exposes APIs or supports webhooks and automations, the integration is an intermediate service: the system sends the event (e.g. "new order", "new document"), a small script calls the Claude API, and the result goes back into the system or into a notification. There is no need to modify the management system itself — you work at the edges, where data enters and leaves.

Without writing code

Automation platforms such as Make or Zapier have ready-made blocks for calling AI models: connect the email inbox or spreadsheet as input, the AI block in the middle, and the destination as output, by dragging elements rather than writing code. It is an excellent way to validate an idea before having it properly developed.

Three things
that reduce costs

  • Batch (deferred processing). If you do not need the reply immediately, batch processing costs half as much on both input and output. Perfect for processing archives of documents overnight.
  • Prompt caching. If you always repeat the same long context (the same instructions, the same manual), you can "cache" it: subsequent reads cost roughly one tenth of the original. It pays off when the same long text appears in many requests.
  • Choosing the right model. Not everything warrants the most powerful model. Haiku often handles 80% of the work perfectly well at one fifth of the cost of Opus.

How
to avoid them

  • No spending limit. Set one immediately in the console: a loop running without a ceiling is the only way to get an unpleasant surprise.
  • Key in the code. Always use an environment variable — never plain text in the source.
  • Sending more data than necessary. Every input token costs money. Send the document you need, not the entire archive.
  • Expecting identical replies every time. The model may vary its wording. If you need a fixed format (e.g. JSON), ask for it explicitly in the prompt and validate the output.

In summary

A key from the console, an HTTP request to the messages endpoint, a model chosen based on cost and quality. From there, connect the API where your data already flows — a spreadsheet, a management system, a script — and always keep a spending limit in place. Prices and model names change over time: for the current figures, the source of truth is the official pricing page at claude.com/pricing and the documentation at docs.claude.com.

Frequently asked
questions

Can I try the Claude API without paying?

Yes. New accounts on platform.claude.com receive a small free credit for initial testing, with no credit card required. Enough to validate a use case across a few hundred requests with the more economical models.

What is the difference between using the API and using claude.ai via the app?

The underlying intelligence is the same; what changes is the interface. The app provides a chat for a person to type and read. With the API, it is your software that sends the question and receives the answer — useful for integrating the model into spreadsheets, management systems or automated scripts.

What happens if I exceed the spending limit I set?

Requests are simply blocked until the following month or until you raise the ceiling. That is precisely the safety net you need against errors that send requests in an infinite loop. Set it immediately, before you write the first line of code.

Can I use the API with confidential client data?

Yes, but with care: use the business/API plans (not the free consumer plans), sign the DPA with Anthropic before processing personal data, and consider the option of deploying via your own cloud environment (AWS Bedrock, Google Vertex) with EU data residency for the most sensitive data. See also the guide on privacy and security.

Do prices and model names change often?

Prices tend to fall over time (more capability for the same cost), and new models are released every few months. The source of truth for current figures is the official pricing page at claude.com/pricing. Build your code so that you can change the model with a single line.

Want to discuss
your specific case?

A 30-minute call to get your bearings. No pre-packaged demos.

Write to us at [email protected]

← Back to the guides