Skip to main content

Snowcell Python SDK

Python SDK for the Snowcell API.

This is a lightweight alternative to the OpenAI SDK that can be integrated into your applications.


Install

pip install snowcell

Quickstart

import os
from snowcell import Snowcell

client = Snowcell(api_token=os.environ["SNOWCELL_API_TOKEN"])

res = client.chat.create(
    model="Meditron3-8B",
    messages=[{"role": "user", "content": "Say hello."}],
    max_tokens=50,
)
print(res.choices[0].message.content)

Streaming

from snowcell import Snowcell

client = Snowcell(api_token="YOUR_API_TOKEN")

for event in client.chat.stream(
    model="Meditron3-8B",
    messages=[{"role": "user", "content": "Write one short sentence."}],
    max_tokens=40,
):
    # Each `event` is a dict parsed from SSE "data:" lines
    print(event)

API

Client

from snowcell import Snowcell

client = Snowcell(
  api_token="...", # or set SNOWCELL_API_TOKEN env var
)

Chat

res = client.chat.create(
    model="Meditron3-8B",
    messages=[{"role": "user", "content": "Explain attention in one line."}],
    max_tokens=80,
)
print(res.choices[0].message.content)

Async:

res = await client.chat.acreate(model="Meditron3-8B", messages=[{"role":"user","content":"Hi"}], max_tokens=80)

Streaming:

for evt in client.chat.stream(model="Meditron3-8B", messages=[{"role":"user","content":"Hi"}], max_tokens=80):
    print(evt)

Completions

res = client.completions.create(
    model="Meditron3-8B",
    prompt="Hello world!",
    max_tokens=32,
)
print(res.choices[0].text)

Async:

res = await client.completions.acreate(model="Meditron3-8B", prompt="Hello world!", max_tokens=32)

Configuration

You can set these environment variables instead of passing args:

  • SNOWCELL_API_TOKEN – bearer token for authentication
  • SNOWCELL_INFERENCE_BASE_URL – override the inference origin (e.g., http://127.0.0.1:11434 for local testing)

The SDK sends User-Agent: snowcell-python/<version> and uses timeouts tuned for LLMs: connect=5s, write=30s, read=300s.


Errors

The SDK raises SnowcellError for 4xx/5xx responses with server details included. Common cases:

  • 401/403 – check your token / project permissions
  • 422 – request validation error (inspect the server message)
  • 429 – rate limited; retry after the indicated delay
  • 5xx – transient server error; try again later

Versioning

  • Initial public release: 0.1.0 (chat, completions; sync/async; streaming for chat)
  • Backwards-compatible fixes → patch bump (0.1.x)
  • New features/endpoints → minor bump (0.x.y)

See CHANGELOG.md.


License

MIT – see LICENSE.

Metadata

Release files for snowcell 0.1.0

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

Source distribution (sdist)

Source distribution for snowcell 0.1.0
File Size Uploaded
snowcell-0.1.0.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snowcell 0.1.0
File Interpreter ABI Platform
snowcell-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / snowcell-0.1.0.tar.gz

Download URL snowcell-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f40bf537b12cd496ca9093c0c3dedb56c6eb0883e6932047885e8765b724fd20
BLAKE2b-256 checksum
How to use checksums
907142cb9f69b798de810ad19d18d3ff2230994d62190eafaf53ee3029581fbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / snowcell-0.1.0-py3-none-any.whl

Download URL snowcell-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4b1f075a781951f692d74c7ef808ae4edbc15d1147eeeddcb43b060d246bbf1
BLAKE2b-256 checksum
How to use checksums
d64c6d9cc566579d3a3c8240e163215da3b6bb320c5454f3e7de555aaa293d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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