FluxCompute SDK

Route every query to the cheapest model that can answer it

FluxCompute classifies each request and dispatches it to the right tier, so simple questions stop costing frontier-model prices, and reports exactly what you saved on every call.

Install

shell
pip install fluxcompute

Python 3.10 or newer. The SDK is Apache-2.0 licensed and has no FluxCompute account requirement: routing and savings accounting work entirely against your own provider keys.

Your first routed call

quickstart.py
import asyncio
from fluxcompute import FluxClient


async def main():
    client = FluxClient(anthropic_key="sk-ant-...")

    response = await client.messages.create(
        model="auto",                                    # let FluxCompute decide
        messages=[{"role": "user", "content": "What is 2+2?"}],
    )

    print(response.text)                          # "4"
    print(response.fluxcompute.model_selected)    # claude-haiku-4-5-20251001
    print(response.fluxcompute.savings_usd)       # 0.00016

    await client.close()


asyncio.run(main())

Migrating from the Anthropic or OpenAI SDK

Swap the client and pass model="auto". The response object keeps the fields you already use, with routing and cost data added under response.fluxcompute. Pin a specific model any time by passing it instead of "auto".

Keys are read from the environment when not passed explicitly, matching the provider SDK conventions. See Configuration.

Where to go next