Skip to main content

Overview

While ModelStack uses an OpenAI-compatible API format, you can also use the Anthropic SDK by pointing it to ModelStack’s API endpoint. This lets you use Anthropic-specific features while routing through ModelStack’s unified billing and gateway.
We recommend using the OpenAI SDK for the best compatibility across all providers. The Anthropic SDK only works with Claude models.

Python

Installation

Setup

Chat Completion

Streaming

TypeScript / Node.js

Installation

Setup

Chat Completion

Streaming

When to Use the Anthropic SDK

Use the Anthropic SDK when you:
  • Need Anthropic-specific features (tool use with Anthropic’s format, prompt caching)
  • Are only using Claude models
  • Have existing Anthropic SDK code and want minimal changes
Use the OpenAI SDK when you:
  • Want to switch between providers (Claude, GPT, Gemini) without changing SDKs
  • Need a single SDK for all models
  • Want maximum flexibility