Skip to main content

Python SDK

Python client for the Nova AI API.

The package is intentionally small:

  • sync methods
  • no external dependencies
  • typed request and response structures
  • simple streaming support for chat completions with a normal for loop
  • audio helpers for transcription, translation, and speech generation

Install

pip install datalabrotterdam-nova-sdk

Create A Client

from nova_ai import NovaAIClient

client = NovaAIClient(
    api_key="sk_live_..."
)

If you do not pass base_url, the client uses https://api.nova.datalabrotterdam.nl/v1.

Example: Normal Chat

from nova_ai import NovaAIClient

client = NovaAIClient(
    api_key="sk_live_..."
)

completion = client.chat.completions.create({
    "model": "llama3.2",
    "messages": [
        {"role": "system", "content": "You are helpful."},
        {"role": "user", "content": "Explain embeddings in one sentence."}
    ],
    "max_tokens": 256,
    "temperature": 0.7,
})

print(completion["choices"][0]["message"]["content"])
print(completion.get("usage_source"))
print(completion.get("metrics", {}).get("tokens_per_second"))

completion["usage_source"] is:

  • "provider" when the upstream provider reported usage
  • "gateway_estimated" when Nova AI estimated usage to keep the contract consistent

Example: Streaming Chat

from nova_ai import NovaAIClient, collect_chat_text

client = NovaAIClient(
    api_key="sk_live_..."
)

stream = client.chat.completions.stream({
    "model": "llama3.2",
    "messages": [{"role": "user", "content": "Write three short tips."}]
})

for event in stream:
    if event["type"] == "chunk":
        choices = event["data"].get("choices", [])
        if choices:
            print(choices[0].get("delta", {}).get("content", ""), end="")

print()

print(collect_chat_text(client.chat.completions.stream({
    "model": "llama3.2",
    "messages": [{"role": "user", "content": "Summarize vectors in one line."}]
})))

Example: Embeddings

from nova_ai import NovaAIClient

client = NovaAIClient(
    api_key="sk_live_..."
)

embedding = client.embeddings.create({
    "model": "nomic-embed-text",
    "input": "Nova AI"
})

print(len(embedding["data"][0]["embedding"]))

Example: Audio Transcription

from nova_ai import NovaAIClient

client = NovaAIClient(
    api_key="sk_live_..."
)

transcript = client.audio.transcriptions.create(
    file_path="./sample.wav",
    model="whisper-1",
    language="nl",
)

print(transcript["text"])

Example: Speech Synthesis

from nova_ai import NovaAIClient

client = NovaAIClient(
    api_key="sk_live_..."
)

audio = client.audio.speech.create({
    "model": "Qwen/Qwen3-TTS-12Hz-1.7B-Base",
    "input": "Hello from Nova AI",
    "task_type": "Base",
    "ref_audio": "https://example.com/reference.wav",
    "ref_text": "Exact transcript of the reference audio.",
    "response_format": "wav",
})

with open("speech.wav", "wb") as target:
    target.write(audio)

Included Methods

  • client.providers.list()
  • client.models.list(limit=None, after=None)
  • client.chat.completions.create(payload, config_id=None, request_id=None)
  • client.chat.completions.stream(payload, config_id=None, request_id=None)
  • client.embeddings.create(payload, config_id=None, request_id=None)
  • client.audio.transcriptions.create(file_path=..., model=..., ...)
  • client.audio.translations.create(file_path=..., model=..., ...)
  • client.audio.speech.create(payload, config_id=None, request_id=None)
  • client.audio.voices.list(config_id=None, request_id=None)

Audio Notes

  • client.audio.transcriptions.create() and client.audio.translations.create() upload audio as multipart/form-data.
  • client.audio.speech.create() returns raw bytes.
  • client.audio.voices.list() only exposes non-uploaded voices returned by the gateway.
  • The gateway enforces runtime scopes:
    • audio:transcribe
    • audio:translate
    • audio:synthesis

Why streaming uses for, not async for

For this Python SDK, a normal iterator is the simplest way to support streaming without extra dependencies. That means you can stream like this:

for event in client.chat.completions.stream({...}):
    ...

Using async for is also possible, but it usually means introducing an async HTTP client such as httpx or aiohttp, which makes the first version of the SDK heavier.

Metadata

Release files for datalabrotterdam-nova-sdk 1.5.4

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

Source distribution (sdist)

Source distribution for datalabrotterdam-nova-sdk 1.5.4
File Size Uploaded Provenance Actions
datalabrotterdam_nova_sdk-1.5.4.tar.gz 10.8 kB Without provenance Details for datalabrotterdam_nova_sdk-1.5.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datalabrotterdam-nova-sdk 1.5.4
File Interpreter ABI Platform Actions
datalabrotterdam_nova_sdk-1.5.4-py3-none-any.whl Python 3 none any Details for datalabrotterdam_nova_sdk-1.5.4-py3-none-any.whl

Total release size: 20.8 kB

Release files / datalabrotterdam_nova_sdk-1.5.4.tar.gz

Download URL datalabrotterdam_nova_sdk-1.5.4.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e41878f99a1753d98ef9a2adf5a22f2bde1e1d9f0fec8c7c6f2656510f22f143
BLAKE2b-256 checksum
How to use checksums
1e23b8e3fad6c0842c63ae07dc02d3744e514c5fbcb5e08c6be615aee9c94008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / datalabrotterdam_nova_sdk-1.5.4-py3-none-any.whl

Download URL datalabrotterdam_nova_sdk-1.5.4-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
674956f71a42af788f2fb8fc5fc5d3d1eb8a6f7a54fd79573ac35c8c61d3fb02
BLAKE2b-256 checksum
How to use checksums
33c302f09b6efe9323771e203577147c0534317660731b15052e8e353a0c4806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for datalabrotterdam-nova-sdk 1.5.4

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