ANTHROPIC SDK COMPATIBILITY

Use the Anthropic SDK with WorldGate's Messages API.

WorldGate exposes an Anthropic-compatible Messages endpoint for supported Claude workflows. Native Anthropic clients can use their familiar system prompt, content blocks, max_tokens, streaming, and tool-shaped requests while authenticating with a WorldGate key. Set the base URL without /v1 because the SDK appends the Messages path.

Create an account
01

Use the native Messages request shape

The Anthropic client sends system instructions separately from messages and returns typed content blocks. Code that depends on those native shapes can use the Messages endpoint instead of translating everything through chat completions.

02

Set the base URL without /v1

Initialize the Anthropic client with https://worldgateapi.com as its base URL. The SDK appends /v1/messages, so adding /v1 yourself can create a duplicated path.

03

Authenticate with a WorldGate credential

Pass WORLDGATE_API_KEY as the client's api_key. This is a WorldGate credential for an independent gateway, not an official Anthropic key, account, Pro plan, or Max subscription.

04

Choose max_tokens deliberately

Messages requests require a positive output ceiling. WorldGate accepts output limits from 1 through 16,384; choose a smaller application-specific maximum when long output is unnecessary.

05

Handle content and tool blocks

Do not assume every returned block is plain text. Branch on block type, preserve tool-use identifiers, and return matching tool results. Test the exact streaming and tool workflow before production.

06

Diagnose native-client failures

A login prompt usually means the client did not receive the intended key. A 404 often indicates an incorrect base path. A 400 requires checking model, messages, content blocks, and max_tokens. Billing controls can stop an otherwise valid request.

ANTHROPIC SDK

Keep the native Messages shape.

Use the domain as the base URL with no /v1 and authenticate with a WorldGate server-side key.

import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["WORLDGATE_API_KEY"],
    base_url="https://worldgateapi.com",
)

message = client.messages.create(
    model="claude-opus-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Review this architecture."}],
)

print(message.content[0].text)

METHODOLOGY & SOURCES

Review the native SDKs.

Native SDK setup reviewed against WorldGate's deployed Messages compatibility tests on July 31, 2026. WorldGate is independent and is not affiliated with Anthropic.

COMMON QUESTIONS

What developers ask

What Anthropic SDK base URL should WorldGate use?

Use https://worldgateapi.com without /v1 because the SDK appends /v1/messages.

Do I need an Anthropic API key?

No for WorldGate requests. Use a WorldGate key with the WorldGate endpoint. It is not an official Anthropic credential.

What model name should I use?

Choose a Claude identifier currently returned by WorldGate's model catalogue.

What max_tokens values are accepted?

Use an integer from 1 through 16,384 and choose the lowest practical ceiling for the workload.

Are tool calls supported?

The compatible Messages surface supports tool-shaped traffic, but applications should test their exact block, streaming, and error-handling behavior.

Lower model cost. Clearer usage.

Start with one WorldGate API key.

Start building