Developer guide · Claude Messages

Keep an Anthropic-style request shape while using one gateway.

Call the documented Messages endpoint, use the correct authentication header, and fetch a current model ID before you move an existing Claude integration toward Primordial AI.

Anthropic-style messagesx-api-key authenticationLive model discovery

Quick answer

Send POST https://www.primoraihub.com/v1/messages with x-api-key: YOUR_API_KEY, anthropic-version: 2023-06-01, a model ID from GET /v1/models, max_tokens, and messages.

Endpoint and headers

Messages endpointhttps://www.primoraihub.com/v1/messages
Authenticationx-api-key: YOUR_API_KEY
Version headeranthropic-version: 2023-06-01
Model discoveryGET https://www.primoraihub.com/v1/models
Minimum payloadmodel + max_tokens + messages

Do not replace x-api-key with the OpenAI-style Bearer header for this endpoint. For the OpenAI-compatible format, use the separate OpenAI SDK guide.

Try it with cURL

curl https://www.primoraihub.com/v1/models \
  -H "x-api-key: $PRIMORDIAL_API_KEY"

curl https://www.primoraihub.com/v1/messages \
  -H "x-api-key: $PRIMORDIAL_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MODEL_ID_FROM_V1_MODELS",
    "max_tokens": 512,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Use Python requests

import os
import requests

base = "https://www.primoraihub.com/v1"
headers = {
    "x-api-key": os.environ["PRIMORDIAL_API_KEY"],
    "anthropic-version": "2023-06-01",
    "content-type": "application/json",
}

models = requests.get(f"{base}/models", headers=headers, timeout=30).json()
model_id = models["data"][0]["id"]

response = requests.post(
    f"{base}/messages",
    headers=headers,
    json={
        "model": model_id,
        "max_tokens": 512,
        "messages": [{"role": "user", "content": "Hello"}],
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())

Compatibility checks before release

  • Fetch the live model list and verify that the selected ID is available to your account.
  • Confirm streaming, tool use, vision, system prompts, and content blocks against the current documentation instead of assuming upstream parity.
  • Keep API keys server-side and redact them from logs, screenshots, and public repositories.
  • Record status codes, request IDs, latency, and token usage without recording secret values.

The current API documentation is the source of truth for supported request shapes; the live model endpoint is the source of truth for model IDs.

Common failures

  • 401/403: check the API key and use x-api-key for Messages.
  • Model not found: call GET /v1/models and stop using a copied model name.
  • 400 payload error: confirm model, max_tokens, messages, and the content format documented for the selected model.
  • Feature mismatch: test streaming and tools separately; compatibility at the request envelope does not prove every upstream feature is identical.

Frequently asked questions

What endpoint should an Anthropic-style client call?

Use POST https://www.primoraihub.com/v1/messages with x-api-key, anthropic-version, a live model ID, max_tokens, and messages.

How do I choose a Claude model ID?

Call GET /v1/models and select an ID returned by the live endpoint.

Can Claude models use the OpenAI-compatible endpoint too?

The current Primordial AI documentation lists Claude models for both /v1/messages and /v1/chat/completions; verify the current model and request support before release.