← All articles

Claude API: key, the /v1/messages endpoint, and choosing a model version

A glowing digital access key next to floating volumetric blocks of text on a dark background

The Claude API is how you call Claude models from your own code instead of a chat window: a support bot on your site, a script that triages tickets, code completion in an editor, a CRM integration. On NeuralSpace a key is created in your dashboard in about a minute, requests go to the Anthropic-compatible POST /v1/messages endpoint, and you pay from a token balance with no subscription. Below is a step-by-step guide: how to get a key, what your first call looks like, and how to choose a model version — Haiku, Sonnet, Opus or Fable.

What the Claude API is and how it differs from chat

Claude is Anthropic's family of language models. In a chat window you talk to the model by hand; through the API your code does the same thing: it sends an array of messages, gets a generated answer and uses it in your product — shows it to the user, stores it, processes it further. Typical use cases: support bots, summarising emails and documents, extracting structured data, drafting content, automating routine work in scripts. The key difference from chat is predictability: you set the system instruction, the response limit and the model version yourself, and you see the spend in tokens.

Step 1. Get a key

  1. Sign up for NeuralSpace with your email — it takes under a minute. New users get starter tokens credited, enough for the first requests without topping up.
  2. Open the API keys page in your dashboard, enter a key name (for example, "My bot") and click Create.
  3. The key looks like nsk-… and is shown only once — copy it straight into a password manager or an environment variable, not into your repository code.
  4. Check your balance: text models require at least 50 tokens on the account. Top-ups happen in the dashboard, with no subscription fee.
The NeuralSpace API keys page: creating a key and the Claude quick start

Step 2. Your first call to /v1/messages

Claude text models live on the Anthropic-compatible POST https://neuralspace.pro/v1/messages endpoint. The body carries the model, a messages array with user/assistant roles, the response limit max_tokens (1 to 32000) and an optional system instruction. A minimal curl request:

curl https://neuralspace.pro/v1/messages \
  -H "x-api-key: nsk-your_key" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 1024,
    "system": "You answer technical questions briefly.",
    "messages": [{"role": "user", "content": "How is streaming different from a regular response?"}]
  }'

The response comes back in Anthropic format: the text is in content[0].text and the actual spend is in the usage field. Authenticate with the x-api-key: nsk-… header; clients that only speak Bearer can use Authorization: Bearer nsk-… instead.

Step 3. Plug in the Anthropic SDK

If you already have code on the official Anthropic SDK, you change exactly two values — base_url and the key:

from anthropic import Anthropic

client = Anthropic(
    base_url="https://neuralspace.pro",
    api_key="nsk-your_key",
)

resp = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=1024,
    system="You answer technical questions briefly.",
    messages=[{"role": "user", "content": "Suggest three names for a channel about AI"}],
)
print(resp.content[0].text)

For chat interfaces, streaming helps: add "stream": true and the answer arrives in chunks over Server-Sent Events, so the user sees the first words before generation finishes.

Which model version to pick

The public NeuralSpace catalogue has four Claude versions, and the difference between them is the balance of speed and price against depth of reasoning. Prices below are in site tokens per million API tokens, with input and output billed separately (at the time of writing; rates are floating):

  • Claude Haiku 4.5 (claude-haiku-4-5) — 41 / 213. The fastest and cheapest: classification, short answers, bulk text processing, rough labelling.
  • Claude Sonnet 5 (claude-sonnet-5) — 152.5 / 767. The workhorse: code, long instructions, context-heavy dialogue. A sensible default.
  • Claude Opus 5 (claude-opus-5) — 359 / 1794.5. For hard tasks: multi-step reasoning, large document analysis, subtle logic.
  • Claude Fable 5 (claude-fable-5) — 718 / 3589.5. The flagship for the most demanding scenarios, where quality matters more than price.

A practical rule: start with Haiku or Sonnet and switch to Opus and Fable selectively, only where the first two genuinely fall short. The version is set by a single model field in the request, so you can compare them on the same prompt.

Streaming, limits and service endpoints

Two limits trip people up early: 60 requests per minute per key and a minimum balance of 50 tokens for text models. Your current balance comes from GET /v1/balance, and a machine-readable list of models with live prices from GET /v1/models. Both require a key. Current rates are always shown in the table on the API documentation page.

Claude API and MCP: hooking it up to Claude Code

The same key connects NeuralSpace to AI agents as an MCP server: the agent itself calls chat, image, video and music generation on behalf of your account. For Claude Code it is one command:

claude mcp add --transport http neuralspace https://neuralspace.pro/mcp \
  --header "Authorization: Bearer nsk-your_key"

If you do not need the API yet, the same models are available in the interface — in chat you can pick Claude and talk without code, and the balance is shared between chat and API.

FAQ

Do I need an Anthropic account or a foreign card?

No. The key is issued in your NeuralSpace dashboard and you pay with account tokens — no subscription and no cloud billing setup.

How is /v1/messages different from /v1/chat/completions?

They are two formats of the same API. /v1/messages mirrors the Anthropic Messages API (fields model, messages, system, max_tokens) and suits Claude models and the Anthropic SDK. /v1/chat/completions is the OpenAI format for GPT and Grok chat models. Only the address and the body structure change.

How much does a Claude API call cost?

Only for the tokens you actually use: Claude Sonnet 5 at the time of writing is 152.5 tokens per million input and 767 per million output. A request of a couple of thousand tokens costs roughly 1 ₽. Current prices are in GET /v1/models and in the documentation table.

Is there a free tier?

There are no free generations on the platform. New users get starter tokens, enough for the first runs; after that you pay per token with no subscription fee.