Skip to main content

Quickstart

dijitul AI Gateway implements the Anthropic Messages API. If you have an integration that talks to Anthropic today, changing the base URL is the entire migration.

Get an API key

  1. Create an account and choose a plan.
  2. Open API keys in the dashboard and create a key.
  3. Copy it immediately — the key is displayed once and stored only as a hash. If you lose it, revoke it and create another.

Put it in your environment rather than your source tree:

.env bash
GATEWAY_API_KEY=dj_live_7Qx4mA2vRkP9dLbT1yWnZsHf3jCgEu6V
GATEWAY_BASE_URL=https://ai.dijitul.uk/v1

Base URL

Every endpoint lives under:

POST https://ai.dijitul.uk/v1/messages

So the base URL you give your SDK is https://ai.dijitul.uk/v1. Paths, request bodies, response shapes, streaming events and error objects all match the Anthropic Messages API. There is no proprietary envelope to unwrap.

Your first request

curl https://ai.dijitul.uk/v1/messages \
  -H "authorization: Bearer $GATEWAY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "In one sentence: what is an API gateway?"}
    ]
  }'

Note that no anthropic-version header is required — we default to a supported version. You may send one, and it will be honoured.

The response

{
  "id": "msg_01Xh8Kd2Qw9Lm4Nb7Pv3Rt6Y",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-6",
  "content": [
    {
      "type": "text",
      "text": "An API gateway is a single entry point that receives client requests, applies cross-cutting concerns such as authentication, rate limiting and routing, and forwards them to the appropriate backend service."
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 18,
    "output_tokens": 41,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0
  }
}

The usage object is what we meter against your allowance. It is returned on every call, so your own cost dashboards can be built from the response you already have rather than from a separate reporting API.

Alongside the body, three headers describe how the request was routed:

Header Example Meaning
X-Gateway-Residency uk The residency tier the key is restricted to.
X-Gateway-Regions eu-west-2 The regions this request was eligible to be processed in.
X-Gateway-Model anthropic.claude-sonnet-4-6 The underlying model identifier that was actually invoked.

Streaming

Set "stream": true and you get server-sent events in exactly the Anthropic format — message_start, content_block_delta, message_stop and the rest. The SDK helpers work unchanged:

with client.messages.stream(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Write a haiku about latency."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

Full event reference is on the Messages page.

Choosing a residency tier

Each key carries a residency tier, which determines both where inference happens and which models you may call:

Tier Processed in Models
uk London (eu-west-2) only Claude Sonnet 4.6, Claude Opus 4.6
eu Any of seven EU/EEA regions All models in the catalogue

Requesting a model that has no route within your tier returns residency_unavailable rather than being served from a wider scope. See data residency for the full position and models for the catalogue.

Next steps

  • Authentication — key format, rotation, IP allow-listing.
  • Messages — full parameter reference, tool use, vision, streaming.
  • Errors — every error type and what to do about it.
  • Privacy modes — what the model actually sees.
  • Migrating — from the Anthropic API, or from OpenAI.