Skip to main content

Route LLM calls through Starport gateway

Project description

Starseer Python SDK

Route LLM API calls through Starport gateway.

Install

pip install starseer

Quick Setup (CLI) — Agent Frameworks

The SDK ships a starseer install CLI that configures AI agent frameworks (e.g. Claude Code) to route their traffic through Starport. If you want to run that tool directly from the repo rather than installing via pip:

git clone https://github.com/Starseer-ai/starseer-python-sdk
cd starseer-python-sdk
uv sync
uv run starseer install
#uv run python -m starseer install #(on Windows)

Configure AI agent frameworks (Claude Code, etc.) to use Starport with a single command:

# Interactive — walks you through setup
starseer install

# Silent — provide all options via flags
starseer install --api-key ssk_... --frameworks claude-code --scope global

Run starseer install --help for all options.

Usage — Python SDK

import starseer
import openai

starseer.protect(openai)

client = openai.OpenAI()
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello!"}]
)

Async clients are also supported:

client = openai.AsyncOpenAI()
response = await client.chat.completions.create(...)

To restore original SDK behavior:

starseer.unprotect(openai)

Tracing

Group multiple LLM calls under a single trace for correlated observability:

with starseer.trace() as t:
    response1 = openai_client.chat.completions.create(...)
    response2 = anthropic_client.messages.create(...)
    print(f"Trace ID: {t.trace_id}")

All calls within the context share the same W3C trace ID.

Configuration

Set your virtual key via environment variable:

export STARSEER_API_KEY=ssk_...

Or configure in code:

starseer.configure(
    api_key="ssk_...",
    gateway_url="https://gateway.starseer.ai",  # optional
    openai_route="/openai/v1",              # optional, customize routing
    anthropic_route="/anthropic",           # optional
    auto_trace=True,                        # optional, auto-generate trace headers
)

Environment Variables

Variable Required Default
STARSEER_API_KEY Yes -
STARSEER_GATEWAY_URL No https://gateway.starseer.ai

vLLM Routing

Route OpenAI SDK calls to a vLLM backend through the gateway:

starseer.configure(
    gateway_url="http://localhost:8080",
    api_key="ssk_...",
    openai_route="/vllm/v1"
)

starseer.protect(openai)

client = openai.OpenAI()
response = client.chat.completions.create(
    model="meta-llama/Llama-3-8b",
    messages=[{"role": "user", "content": "Hello!"}]
)

vLLM provides an OpenAI-compatible API, you can use the standard OpenAI SDK with the openai_route pointed to your vLLM endpoint.

Cross-Provider Routing (Starport)

Use the OpenAI SDK to call Anthropic or other providers through Starport's OpenAI-compatible translation layer:

import starseer
import openai

starseer.configure(
    gateway_url="https://your-starport-proxy.com",
    openai_route="/anthropic/openai/v1"
)

starseer.protect(openai)

client = openai.OpenAI()
response = client.chat.completions.create(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Hello!"}]
)

This allows you to use OpenAI SDK patterns while routing requests to Anthropic models on the backend.

Supported SDKs

  • openai (sync and async)
  • anthropic (sync and async)
  • google-genai (also detects the deprecated google-generativeai)

Development

# Install with dev dependencies
uv sync --dev

# Run tests
uv run pytest

# Lint and format
uv run ruff check src/
uv run ruff format src/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

starseer-0.1.0.tar.gz (96.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

starseer-0.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file starseer-0.1.0.tar.gz.

File metadata

  • Download URL: starseer-0.1.0.tar.gz
  • Upload date:
  • Size: 96.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for starseer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4a352fcc05e72391dcb912268618d35e8b4b5d6511dbe238c7d8d6bed0a13add
MD5 c0220d5f5f48dff98b5d85f371e48d5c
BLAKE2b-256 d537a4e35f70494247323b1bb943b31b72595875669137c0c829e5441cea4dc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for starseer-0.1.0.tar.gz:

Publisher: distribution.yml on Starseer-ai/starseer-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file starseer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: starseer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for starseer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00e832841a7514f24bcce44a5e5206c5af4d0234bc128729f0822a522fbf2c74
MD5 7cb6b1244a4f5a61b5b1deb5b2a9d1ce
BLAKE2b-256 8d4ea5bff01b124b2470bcc0fd026606a3921ff18f92db77563cbe406a3fd3f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for starseer-0.1.0-py3-none-any.whl:

Publisher: distribution.yml on Starseer-ai/starseer-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page