Skip to main content

callosum-sdk

callosum-sdk provides an AsyncOpenAI-compatible client for latency-insensitive models running on spot capacity. A familiar chat-completions call becomes a background submit/poll operation without holding an HTTP connection across a GPU cold start.

Install

pip install callosum-sdk

Quickstart

import asyncio
import os

from callosum_sdk import AsyncOpenAI


async def main() -> None:
    async with AsyncOpenAI(
        api_key=os.environ["CALLOSUM_API_KEY"],
        base_url=os.environ.get("CALLOSUM_BASE_URL", "https://api.callosum.ai/v1"),
    ) as client:
        response = await client.chat.completions.create(
            model="qwen3.5-4b",
            messages=[{"role": "user", "content": "What is the corpus callosum?"}],
        )
        print(response.choices[0].message.content)


asyncio.run(main())

Run uv run demo-readme from a source checkout to execute that exact Quickstart block. Set CALLOSUM_BASE_URL to target a staging gateway or port-forward; otherwise it defaults to the public API.

The SDK sends the public slug as spot/qwen3.5-4b, which selects the gateway's spot proxy. The gateway maps that slug through its deployed model catalogue and forwards to the spot orchestrator's background API. The returned response still reports qwen3.5-4b, keeping the routing namespace transparent to application code.

Available models

Pass the slug alone and it is served on spot capacity; the SDK adds the namespace.

Slug Model Shape
qwen3.5-4b Qwen3.5-4B One GPU per replica
deepseek-v4-flash DeepSeek-V4-Flash-0731 304B mixture-of-experts, four GPUs per replica

The slug set is the gateway's, not the SDK's: a syntactically valid slug with no deployed serving profile returns unknown_model, so a new model becomes available without an SDK release.

Passthrough models

Some models are not ours to schedule: the gateway proxies them to an always-on upstream and returns the reply on the same connection. Name one by its namespace and the SDK sends it straight through, so the choice is a model name rather than a different client.

Slug Upstream
cerebras/gpt-oss-120b Cerebras
cerebras/zai-glm-4.7 Cerebras
response = await client.chat.completions.create(
    model="cerebras/gpt-oss-120b",
    messages=[{"role": "user", "content": "What is the corpus callosum?"}],
)

The rule is the namespace: a slug with no / is spot-backed and goes through the background submit/poll protocol, while a slug carrying one names a passthrough upstream and goes to the gateway's ordinary chat completions route. That is the same line the gateway itself draws, so the two cannot disagree.

Because a passthrough answers immediately, it keeps what the background protocol has to give up — stream=True works:

stream = await client.chat.completions.create(
    model="cerebras/gpt-oss-120b",
    messages=[{"role": "user", "content": "Explain the corpus callosum."}],
    stream=True,
)
async for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

deepseek-v4-flash is a reasoning model that answers directly unless asked to deliberate. Request deliberation per call:

response = await client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "What is the corpus callosum?"}],
    extra_body={"chat_template_kwargs": {"thinking": True}},
)
print(response.choices[0].message.reasoning_content)
print(response.choices[0].message.content)

The deliberation arrives as reasoning_content on the message, leaving content as the answer alone. It is an additional field rather than part of the typed OpenAI surface, so it is readable but invisible to type checkers.

Behaviour and limits

  • chat.completions.create() is non-streaming: it submits immediately, polls every five seconds, and returns a typed OpenAI ChatCompletion at completion.
  • The default one-hour client wait can be changed with request_timeout_seconds, and a request declaring deadline_seconds raises it to outlive that deadline; the request continues in the orchestrator if a local caller is cancelled.
  • Polling waits out a briefly absent endpoint rather than failing the call, so a deploy of the spot orchestrator costs a pause instead of a lost response. See the spot client guide.
  • Polls remain authenticated and tenant-scoped, but do not consume the customer's request-per-minute API limit.
  • Every submit carries an Idempotency-Key, so a submit whose response is lost is retried onto the request it already opened rather than running the completion twice. See the spot client guide.
  • model_prefix="spot/" is idempotent. Passing an already namespaced model does not produce spot/spot/.... Setting it to another background namespace points the client at a different endpoint; switch/ reaches the always-on small-model fleet, described in the switch guide.
  • The API key identifies the tenant. A response id submitted by one tenant cannot be polled by another.
  • Raw Files and Batch API batching remains available through the explicit BatchOpenAI class for non-spot workload batches.

See the spot client guide for the routing contract, the switch guide for the always-on small-model fleet, and the batching guide for BatchOpenAI.

Metadata

Release files for callosum-sdk 0.2.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for callosum-sdk 0.2.11
File Size Uploaded Provenance
callosum_sdk-0.2.11.tar.gz 17.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for callosum-sdk 0.2.11
File Interpreter ABI Platform
callosum_sdk-0.2.11-py3-none-any.whl Python 3 none any Details

Total release size: 39.5 kB

Release files / callosum_sdk-0.2.11.tar.gz

Download URL callosum_sdk-0.2.11.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4ed9d30fcb64dd260635fea00276aacc145636a63670b2a23fe7fba4eb9015be
BLAKE2b-256 checksum
How to use checksums
1a29ed85b83fab5fadf43b35b4faedcc7589b4d2c8f264f1ce08a99374e874e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / callosum_sdk-0.2.11-py3-none-any.whl

Download URL callosum_sdk-0.2.11-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1da2058fe2b16068bcabcfcbf977b189f34155f893b5a0c38f88d2a6a72824d0
BLAKE2b-256 checksum
How to use checksums
19226c48efb4950a2f953e7d0683855b41995c7ae9e872cf1392e12b8febe8cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for callosum-sdk 0.2.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page