Metadata-Version: 2.5
Name: tokenspend
Version: 0.1.1
Summary: Official Python client for the TokenSpend API
Project-URL: Documentation, https://tokenspend.dev/docs/router
Project-URL: Homepage, https://tokenspend.dev
Project-URL: Repository, https://github.com/haseebc2000/token-spend
Author: TokenSpend
License-Expression: MIT
License-File: LICENSE
Keywords: ai,api,llm,tokenspend
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# TokenSpend Python

Official Python client for the TokenSpend API. It has no runtime dependencies.

```bash
pip install tokenspend
export TOKENSPEND_API_KEY=tsr_...
```

```python
from tokenspend import TokenSpend

client = TokenSpend()
response = client.chat.completions.create(
    model="xai/grok-4.5",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
```

Set `stream=True` to iterate over server-sent chunks. `client.messages.create(...)`
uses the Anthropic-compatible Messages API. See https://tokenspend.dev/docs/router.

Every registry model uses the same method:

```python
for model in (
    "xai/grok-4.5",
    "meta/muse-spark-1.2",
    "thinking-machines/inkling",
    "moonshot/kimi-k3",
):
    response = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": "Hello"}],
    )
```

The SDK never accepts a serving-host selector.
