• Playground
  • Models
  • Rankings
  • Pricing
  • Support
Docs
  • About Boundless
  • Quickstart
  • API Compatibility
  • Models
  • OpenAI SDK
  • Anthropic SDK
  • Vercel AI SDK
  • LangChain
  • Streaming
  • Tool calling
  • Reasoning
  • Errors
  • MPP & Agentic Payments
  • Credits & Billing
  • Rate Limits
  • Teams
  • Privacy & ZDR
  • FAQ
  • Coding agents
    Coding Agents & Harnesses
  • Claude Code
  • Claude Desktop
  • Codex CLI
  • Codex app
  • OpenCode
  • Cursor
  • Cline
  • GitHub Copilot
  • Kilo Code
  • Qwen Code
  • Amp
  • CodeBuddy
  • Hermes
  • Hermes Desktop
  • JetBrains AI & Junie
  • Cherry Studio
  • Mastra
  • MiMo Code
  • Muse
  • omp (Oh My Pi)
  • OpenClaw
  • OpenHands
  • T3 Code
  • Advanced
    System One
All systems operational
© 2026 BoundlessTermssupport@boundless.network

Anthropic SDK

Use the Anthropic Python and TypeScript SDKs with Boundless through POST /v1/messages: install, base URL and key, streaming and tool use.

The gateway serves the Anthropic Messages API at POST /v1/messages. The Anthropic SDKs work against it with a new base URL and a Boundless key.

Install#

pip install anthropic
npm install @anthropic-ai/sdk

Base URL and key#

The Anthropic SDKs add /v1/messages themselves, so give them the gateway root: https://api.inference.boundless.network, with no /v1. The gateway takes the key as x-api-key, which is what these SDKs send, or as Authorization: Bearer.

export BOUNDLESS_API_KEY="paste-your-key-here"

Use a model ID exactly as the models table lists it. Any model there works on Messages, not only the Claude models.

Make a request#

max_tokens is required and must cover thinking plus the reply. Give reasoning models 1024 or more.

import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["BOUNDLESS_API_KEY"],
    base_url="https://api.inference.boundless.network",
)

message = client.messages.create(
    model="deepseek/deepseek-v4.1-flash-1017",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Say hello"}],
)

for block in message.content:
    if block.type == "text":
        print(block.text)
print(message.usage)
import Anthropic from "@anthropic-ai/sdk"

const client = new Anthropic({
  apiKey: process.env.BOUNDLESS_API_KEY,
  baseURL: "https://api.inference.boundless.network",
})

const message = await client.messages.create({
  model: "deepseek/deepseek-v4.1-flash-1017",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Say hello" }],
})

for (const block of message.content) {
  if (block.type === "text") console.log(block.text)
}
console.log(message.usage)

Stream the reply#

The gateway sends the standard Anthropic server-sent events.

with client.messages.stream(
    model="deepseek/deepseek-v4.1-flash-1017",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Say hello"}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)
    print(f"\n{stream.get_final_message().usage}")
const stream = client.messages.stream({
  model: "deepseek/deepseek-v4.1-flash-1017",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Say hello" }],
})

stream.on("text", (text) => process.stdout.write(text))
const final = await stream.finalMessage()
console.log("\n", final.usage)

Call a tool#

The model answers with a tool_use block. You run the function and send a tool_result block back.

message = client.messages.create(
    model="deepseek/deepseek-v4.1-flash",
    max_tokens=1024,
    tools=[{
        "name": "add",
        "description": "Add two integers.",
        "input_schema": {
            "type": "object",
            "properties": {"a": {"type": "integer"}, "b": {"type": "integer"}},
            "required": ["a", "b"],
        },
    }],
    tool_choice={"type": "tool", "name": "add"},
    messages=[{"role": "user", "content": "What is 20 + 22? Use the add tool."}],
)

call = next(block for block in message.content if block.type == "tool_use")
print(call.name, call.input)

Tool calling covers the other wire formats.

Known differences#

  • Responses are Anthropic-shaped: content blocks, stop_reason, tool_use, and usage with input_tokens and output_tokens.
  • Errors use the Anthropic shape, {"type": "error", "error": {"type", "message"}}, with no code and no param. Match on error.type. See Errors.
  • POST /v1/messages/count_tokens counts input tokens without running the request.
  • Credits that run out return 402. The error type is billing_error, and the SDK does not retry it.
  • Anthropic-hosted features are not served. See API Compatibility.
  • After a 502, a timeout or a dropped stream, check GET /v1/requests/{id} before you resend. See Retrying safely.
NextVercel AI SDK