plaingateway
Integrations

Anthropic SDK

Configure the Anthropic SDK to call plaingateway.

The SDK appends /v1/messages to the base URL, so the base URL stops at /api.

python
import os
from anthropic import Anthropic

client = Anthropic(base_url="https://api.plaingateway.com/api", api_key=os.environ["PLAINGATEWAY_API_KEY"])
msg = client.messages.create(
    model="openai/gpt-5.6-luna",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)
typescript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ baseURL: "https://api.plaingateway.com/api", apiKey: process.env.PLAINGATEWAY_API_KEY });
const msg = await client.messages.create({
  model: "openai/gpt-5.6-luna",
  max_tokens: 256,
  messages: [{ role: "user", content: "Hello" }],
});

api_key sends the key as x-api-key. auth_token sends it as Authorization: Bearer. Both work. A model ID is the full author/slug string from Models, for example openai/gpt-5.6-luna. The model must be one an AI provider key serves; today that is the openai/ and deepseek/ models. The gateway translates the request for a model on a non-Anthropic host.