Boundless API
  • Product
  • Models
  • Pricing
  • Status
  • Docs
EN中
Get $5 on signup

SDK Examples

Copy-paste examples for common integrations.

On this page
  1. cURL
  2. Python — OpenAI SDK
  3. TypeScript — OpenAI SDK
  4. Python — Streaming
  5. Python — Tool Calling
  6. LangChain
  7. Vercel AI SDK
  8. List Models
  9. Error Handling
  10. Related
Live model IDs

Copy exactly — case-sensitive, no spaces. Details →

  • claude-sonnet-4-6
  • claude-opus-4-8
  • claude-opus-4-7
  • claude-haiku-4-5-20251001
  • gpt-5.5
  • gpt-5.4
Full catalog →

Copy-paste examples for common integrations.

Base URL: https://api.boundlessapi.com/v1


cURL

curl https://api.boundlessapi.com/v1/chat/completions \
  -H "Authorization: Bearer $BOUNDLESS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Say hi"}]
  }'

Python — OpenAI SDK

pip install openai
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["BOUNDLESS_API_KEY"],
    base_url="https://api.boundlessapi.com/v1",
)

response = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Explain quantum computing in one sentence."}],
)
print(response.choices[0].message.content)

TypeScript — OpenAI SDK

npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.BOUNDLESS_API_KEY,
  baseURL: "https://api.boundlessapi.com/v1",
});

const res = await client.chat.completions.create({
  model: "claude-sonnet-4-6",
  messages: [{ role: "user", content: "Say hi" }],
});
console.log(res.choices[0].message.content);

Python — Streaming

stream = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Count to 5"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Python — Tool Calling

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

response = client.chat.completions.create(
    model="claude-haiku-4-5",
    messages=[{"role": "user", "content": "Weather in NYC?"}],
    tools=tools,
)

LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="claude-sonnet-4-6",
    openai_api_key=os.environ["BOUNDLESS_API_KEY"],
    openai_api_base="https://api.boundlessapi.com/v1",
)
print(llm.invoke("Hello!").content)

Vercel AI SDK

import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const boundless = createOpenAI({
  apiKey: process.env.BOUNDLESS_API_KEY,
  baseURL: "https://api.boundlessapi.com/v1",
});

const { text } = await generateText({
  model: boundless("claude-sonnet-4-6"),
  prompt: "Hello!",
});

List Models

models = client.models.list()
for m in models.data:
    print(m.id)

Error Handling

from openai import OpenAI, APIStatusError

try:
    response = client.chat.completions.create(...)
except APIStatusError as e:
    if e.status_code == 402:
        print("Add credits at https://boundlessapi.com/billing")
    elif e.status_code == 429:
        print("Rate limited — retry with backoff")
    else:
        raise

Related

  • Quickstart
  • API Reference
  • Migrating from OpenRouter

© 2026 Boundless API · Home · Privacy Policy · Terms