⚡ Your AI bill is eating your Q4 margin.Protect Your Margin. Get a FREE 360° Cost ReportFree 360° Cost Report

Home › Docs › SDKs and integrations

Get started

SDKs and integrations

Point your OpenAI or Anthropic SDK at apicuts and keep your existing application code. OpenAI Responses, OpenAI Chat Completions, and native Anthropic Messages are all live today.

Sign up, fund your prepaid wallet in /app/funding, and generate an ack_... company key in /app/keys (stored below in $APICUTS_API_KEY). Use https://apicuts.ai/v1 for OpenAI SDKs (OPENAI_BASE_URL, OPENAI_API_BASE, or APICUTS_BASE_URL), OpenAI Responses, and Gemini models via OpenAI-compatible format (native Gemini format is on our roadmap). Use https://apicuts.ai for Anthropic SDKs (ANTHROPIC_BASE_URL), which append /v1/messages automatically. Fetch current enabled model IDs from GET https://apicuts.ai/v1/models, install supported Mac coding tools with the macOS Companion V1 (curl -fsSL https://apicuts.ai/install | sh -s -- --key $APICUTS_API_KEY), or book a free 360° Cost Report.

Fetch live model IDs

Shell
curl -sS "https://apicuts.ai/v1/models" \
  -H "Authorization: Bearer $APICUTS_API_KEY"

OpenAI Python SDK (Responses API)

OpenAI Responses (/v1/responses) requires stream=True and Authorization: Bearer $APICUTS_API_KEY:

Python
import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ.get("OPENAI_BASE_URL", "https://apicuts.ai/v1"),
    api_key=os.environ["APICUTS_API_KEY"],
)

stream = client.responses.create(
    model=os.environ["APICUTS_MODEL_ID"],  # Active model ID from GET /v1/models
    input="Summarize last week's token savings in 3 bullets.",
    stream=True,
)
for event in stream:
    if event.type == "response.output_text.delta":
        print(event.delta, end="", flush=True)

OpenAI Python SDK (Chat Completions)

OpenAI Chat Completions (/v1/chat/completions) requires stream=True, Authorization: Bearer, and a unique Idempotency-Key header per logical request (do not reuse keys across distinct payloads):

Python
import os, uuid
from openai import OpenAI

client = OpenAI(
    base_url=os.environ.get("APICUTS_BASE_URL", "https://apicuts.ai/v1"),
    api_key=os.environ["APICUTS_API_KEY"],
)

stream = client.chat.completions.create(
    model=os.environ["APICUTS_MODEL_ID"],  # Active model ID from GET /v1/models
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
    extra_headers={"Idempotency-Key": str(uuid.uuid4())},
)
for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Anthropic Python SDK (native Messages)

Native /v1/messages supports both streaming and non-streaming requests. Pass ANTHROPIC_BASE_URL="https://apicuts.ai" without /v1, keep system instructions in the top-level system field (not as a mid-conversation role: "system" message), and send either x-api-key (default in the Anthropic SDK) or Authorization: Bearer — never both:

Python
import os
from anthropic import Anthropic

client = Anthropic(
    base_url=os.environ.get("ANTHROPIC_BASE_URL", "https://apicuts.ai"),
    api_key=os.environ["APICUTS_API_KEY"],
)

message = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    system="You are a concise engineering assistant.",
    messages=[{"role": "user", "content": "Hello"}],
)
print(message.content[0].text)

OpenAI TypeScript SDK

TypeScript
import crypto from "node:crypto";
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: process.env.OPENAI_BASE_URL ?? "https://apicuts.ai/v1",
  apiKey: process.env.APICUTS_API_KEY,
});

const stream = await client.chat.completions.create(
  {
    model: process.env.APICUTS_MODEL_ID!, // Active model ID from GET /v1/models
    messages: [{ role: "user", content: "Hello" }],
    stream: true,
  },
  {
    headers: { "Idempotency-Key": crypto.randomUUID() },
  },
);
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

LangChain

Set streaming=True and use_responses_api=True against https://apicuts.ai/v1 (or pass a fresh per-request Idempotency-Key header if targeting /v1/chat/completions, or use ChatAnthropic with anthropic_api_url="https://apicuts.ai"):

Python
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model=os.environ["APICUTS_MODEL_ID"],  # Active model ID from GET /v1/models
    base_url=os.environ.get("APICUTS_BASE_URL", "https://apicuts.ai/v1"),
    api_key=os.environ["APICUTS_API_KEY"],
    streaming=True,
    use_responses_api=True,
)
for chunk in llm.stream("Hello"):
    print(chunk.content, end="", flush=True)

LlamaIndex

Configure api_base to https://apicuts.ai/v1 and stream completions (include a fresh per-call Idempotency-Key header when routing through /v1/chat/completions):

Python
import os, uuid
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model=os.environ["APICUTS_MODEL_ID"],  # Active model ID from GET /v1/models
    api_base=os.environ.get("APICUTS_BASE_URL", "https://apicuts.ai/v1"),
    api_key=os.environ["APICUTS_API_KEY"],
    is_chat_model=True,
    default_headers={"Idempotency-Key": str(uuid.uuid4())},  # rotate per request
)
for chunk in llm.stream_complete("Hello"):
    print(chunk.delta, end="", flush=True)

Vercel AI SDK

TypeScript
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { streamText } from "ai";

const apicuts = createOpenAICompatible({
  name: "apicuts",
  baseURL: process.env.APICUTS_BASE_URL ?? "https://apicuts.ai/v1",
  apiKey: process.env.APICUTS_API_KEY,
});

const result = streamText({
  model: apicuts(process.env.APICUTS_MODEL_ID!), // Active model ID from GET /v1/models
  prompt: "Hello",
  headers: { "Idempotency-Key": crypto.randomUUID() },
});
for await (const delta of result.textStream) {
  process.stdout.write(delta);
}

cURL (Chat Completions, Responses, and Anthropic Messages)

Shell
# 1. OpenAI Chat Completions (requires stream: true and unique Idempotency-Key)
curl -N "https://apicuts.ai/v1/chat/completions" \
  -H "Authorization: Bearer $APICUTS_API_KEY" \
  -H "Idempotency-Key: req-$(date +%s)" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"$APICUTS_MODEL_ID\",\"stream\":true,\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}"

# 2. OpenAI Responses (requires stream: true and Authorization: Bearer)
curl -N "https://apicuts.ai/v1/responses" \
  -H "Authorization: Bearer $APICUTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"$APICUTS_MODEL_ID\",\"stream\":true,\"input\":\"Hello\"}"

# 3. Native Anthropic Messages (send x-api-key OR Authorization: Bearer, not both)
curl "https://apicuts.ai/v1/messages" \
  -H "x-api-key: $APICUTS_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-5-5","max_tokens":256,"system":"Be brief.","messages":[{"role":"user","content":"Hello"}]}'

Any OpenAI- or Anthropic-compatible tool

Agent frameworks, coding assistants, and internal services that accept a custom Anthropic base URL (https://apicuts.ai) or OpenAI base URL (https://apicuts.ai/v1, including Gemini models) work with your ack_... key from /app/keys.

Behind LiteLLM or Portkey

Already run a gateway? Keep it. Add apicuts as an upstream at https://apicuts.ai/v1 (OpenAI-compatible / Responses) or https://apicuts.ai (Anthropic Messages), and your existing routing and logging stay in place while apicuts handles the savings.

Want us to find your 20%+?

Get a free 360° cost report. Bring last month's provider usage and we'll show you your biggest waste and the first fix we'd ship.

Get a Free 360° Cost Report