LiteLLM Integration

Integrate Thesean with LiteLLM to call supported Ship models through the Anthropic-compatible Messages API.

Ensure you have your Thesean API key from the Thesean Dashboard before continuing.

Overview

LiteLLM provides:

  • A proxy server for centralized access control, spend tracking, and rate limiting
  • A Python SDK for load balancing and cost tracking

LiteLLM Python SDK

Installation

uv add litellm

Basic Usage

from litellm import completion
import os

os.environ["THESEAN_API_KEY"] = "your-thesean-api-key"

response = completion(
    model="anthropic/ship-like/claude-opus-4-8",
    api_base="https://api.thesean.ai",
    api_key=os.environ["THESEAN_API_KEY"],
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)

print(response.choices[0].message.content)

Ship Models

Use LiteLLM's anthropic/ provider prefix before the Ship model name:

LiteLLM consumes the leading anthropic/ prefix to select its Anthropic transport. Thesean receives the remaining ship-like/claude-opus-4-8 model ID.

response = completion(
    model="anthropic/ship-like/claude-opus-4-8",
    api_base="https://api.thesean.ai",
    api_key=os.environ["THESEAN_API_KEY"],
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)

LiteLLM Proxy Server

Create a config.yaml file:

model_list:
  - model_name: ship-opus
    litellm_params:
      model: anthropic/ship-like/claude-opus-4-8
      api_base: https://api.thesean.ai
      api_key: "os.environ/THESEAN_API_KEY"

general_settings:
  master_key: sk-1234

Install and start the proxy:

uv tool install "litellm[proxy]"
litellm --config config.yaml

Use the bare origin for api_base. LiteLLM's Anthropic transport appends /v1/messages automatically.

Send a Messages request through the proxy:

curl http://0.0.0.0:4000/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-1234" \
  -d '{
    "model": "ship-opus",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'

Next Steps

Anthropic SDK Integration

Use the Anthropic SDK directly with Thesean.

Read more

View Available Models

Review supported Ship models and their pricing.

Read more