Skip to main content

Python wrapper for the GWDG SAIA platform REST API

Project description

saia-python

PyPI Python versions License: AGPL-3.0-only Tests Docs DOI

A Python wrapper for the GWDG SAIA (Scalable AI Accelerator) platform REST API.

SAIA provides self-hosted, OpenAI-compatible AI services at GWDG, including chat completions, voice transcription/translation, document conversion, and RAG (ARCANA). This library wraps the REST API so you can use it from Python — both as an object-oriented client and as standalone functions.

Installation

pip install saia-python

Or from source:

git clone https://github.com/fschwar4/saia_python.git
cd saia_python
pip install -e .

Quick Start

from saia_python import SAIAClient

# API key auto-discovered from SAIA_API_KEY env var, .saia_api, or .env file
client = SAIAClient()

# List available models
print(client.models.list_ids())

# Chat completion
response = client.chat.completions(
    model="meta-llama-3.1-8b-instruct",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response["choices"][0]["message"]["content"])

# Check your rate limits
print(client.get_rate_limits())

All services are also available as standalone functions:

from saia_python import list_model_ids, chat_completion

list_model_ids()
chat_completion(model="meta-llama-3.1-8b-instruct", messages=[...])

Supported Services

Service Description GWDG Docs
Chat AI Chat completions with streaming and tool calling Chat AI
Voice AI Audio transcription and translation (Whisper) Voice AI
ARCANA RAG — knowledge base management and retrieval-augmented chat ARCANA
Documents PDF/document conversion via Docling SAIA API
Models List available models, probe tool-calling support SAIA API
Tokenizers Download model tokenizers; count chat-template tokens, special-token overhead, and subword fertility (opt-in [tokenizer] extra) Chat AI Models
Rate Limits Inspect current quota and usage SAIA API

Repository Structure

saia-python/
├── saia_python/                  # Main package
│   ├── __init__.py               # Public API, version, functional wrappers
│   ├── client.py                 # SAIAClient — composes all services
│   ├── chat.py                   # ChatService — completions + streaming
│   ├── voice.py                  # VoiceService — transcribe + translate
│   ├── arcana.py                 # ArcanaService — RAG / knowledge bases
│   ├── models.py                 # ModelsService — list available models
│   ├── tokenizer.py              # Tokenizers — download, chat-template token counting
│   ├── documents.py              # DocumentService — Docling conversion
│   ├── openai_compat.py          # OpenAI SDK compatibility layer
│   ├── auth.py                   # Credential and config discovery
│   ├── rate_limits.py            # RateLimitInfo dataclass + parser
│   ├── exceptions.py             # SAIAError hierarchy + raise_for_status
│   ├── _streaming.py             # Shared SSE iterator
│   └── py.typed                  # PEP 561 typing marker
├── docs/                         # Sphinx documentation (PyData theme)
│   ├── conf.py
│   ├── index.rst
│   ├── quickstart.rst
│   ├── explanations.rst
│   ├── architecture.rst
│   ├── implementation.rst
│   ├── configuration.rst
│   ├── api/                      # API reference (one page per module)
│   ├── development.rst
│   ├── dev_notes.rst
│   ├── testing.rst
│   ├── roadmap.rst
│   └── CHANGELOG.md
├── tests/                        # Unit tests
├── examples/
│   ├── saia_python_demo.ipynb         # Interactive demo
│   ├── openai_compatible_proxy.ipynb  # OpenAI-compatible proxy example
│   ├── config.toml.example            # Template for structured config
│   └── .env.example                   # Template for secrets (.env)
├── .github/workflows/            # CI/CD (tests, docs, PyPI publish)
├── pyproject.toml                # Package metadata + dependencies
├── CITATION.cff                  # Citation metadata (CFF 1.2.0)
├── .gitignore
└── README.md

Documentation

Online documentation: https://fschwar4.github.io/saia_python/

Build the docs locally:

pip install -e ".[docs]"
sphinx-build -b html -w warnings_sphinx_build.txt docs docs/_build/html
python3 -m http.server 8000 --directory docs/_build/html

Citation

If you use saia-python in your work, please cite it. Citation metadata lives in CITATION.cff; GitHub's "Cite this repository" button renders it as APA or BibTeX. A Zenodo DOI will be added here once the first release is archived.

License

AGPL-3.0-only

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

saia_python-0.8.0.tar.gz (99.8 kB view details)

Uploaded Source

Built Distribution

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

saia_python-0.8.0-py3-none-any.whl (80.9 kB view details)

Uploaded Python 3

File details

Details for the file saia_python-0.8.0.tar.gz.

File metadata

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

File hashes

Hashes for saia_python-0.8.0.tar.gz
Algorithm Hash digest
SHA256 74f06f58a94e5e38ca12be867171d9a29ef251ca88063a6dcd68ad39fa13ac25
MD5 2da13728020b515901075c19857bf82c
BLAKE2b-256 6fa2c39305764791ce146b60ffdd23daf463d2212a3a578e910e1b77a1d26e63

See more details on using hashes here.

Provenance

The following attestation bundles were made for saia_python-0.8.0.tar.gz:

Publisher: publish.yml on fschwar4/saia_python

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

File details

Details for the file saia_python-0.8.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for saia_python-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afc418c2e14e7b89e83bf7c68f6aaf388278539e52bff090e218fcbee6e64b99
MD5 fb23972b3ffd264307ed8ae41de59559
BLAKE2b-256 797a8b5ad86afbef31b5c1f94e1af68108a016425365f83f1bcfe9fcc31a5732

See more details on using hashes here.

Provenance

The following attestation bundles were made for saia_python-0.8.0-py3-none-any.whl:

Publisher: publish.yml on fschwar4/saia_python

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