This release is a pre-release and may not be stable for production use.
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
forloop - audio helpers for transcription, translation, speaker diarization, 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: Speaker Diarization
Returns who spoke when (time segments with a speaker label), not the words. Combine it with a verbose_json transcription to get a transcript per speaker.
from nova_ai import NovaAIClient
client = NovaAIClient(
api_key="sk_live_..."
)
result = client.audio.diarizations.create(
file_path="./meeting.wav",
model="nemotron-3-diarization",
)
for segment in result["segments"]:
print(f'{segment["speaker"]}: {segment["start"]}s - {segment["end"]}s')
Labels such as speaker_0 only mean something within one response or stream.
Example: Live Diarization
client.audio.diarizations.stream_url(model) builds the wss:// URL. The SDK has no WebSocket dependency, so bring your own client (here websockets), stream 16 kHz mono PCM16 binary frames, and send {"type": "end"} when done. The full event protocol is in the gateway's API docs (WS /v1/audio/diarization/stream).
import json
import threading
from websockets.sync.client import connect
# Raw 16 kHz mono PCM16, e.g. `ffmpeg -i meeting.mp3 -f s16le -ac 1 -ar 16000 meeting.pcm`
with open("meeting.pcm", "rb") as source:
pcm = source.read()
url = client.audio.diarizations.stream_url("nemotron-3-diarization")
with connect(url, additional_headers={"Authorization": "Bearer sk_live_..."}) as ws:
assert json.loads(ws.recv())["type"] == "ready"
def send_audio():
for offset in range(0, len(pcm), 3200): # ~100 ms per frame
ws.send(pcm[offset:offset + 3200])
ws.send(json.dumps({"type": "end"}))
threading.Thread(target=send_audio, daemon=True).start()
for message in ws:
event = json.loads(message)
if event["type"] == "segment":
print(event["speaker"], event["start"], event["end"])
elif event["type"] in ("done", "error"):
break
Example: Speech Synthesis
from nova_ai import NovaAIClient
client = NovaAIClient(
api_key="sk_live_..."
)
audio = client.audio.speech.create({
"model": "tts-1",
"input": "Hello from Nova AI",
"voice": "alloy",
"response_format": "wav",
})
with open("speech.wav", "wb") as target:
target.write(audio)
List the voices a model offers (values for voice):
voices = client.audio.voices.list("kokoro")["voices"]
Included Methods
client.providers.list()client.models.list(limit=None, after=None)client.chat.completions.create(payload, provider_configuration_id=None, request_id=None)client.chat.completions.stream(payload, provider_configuration_id=None, request_id=None)client.embeddings.create(payload, provider_configuration_id=None, request_id=None)client.audio.transcriptions.create(file_path=..., model=..., ...)client.audio.translations.create(file_path=..., model=..., ...)client.audio.diarizations.create(file_path=..., model=..., provider_configuration_id=None, request_id=None)client.audio.diarizations.stream_url(model)client.audio.speech.create(payload, provider_configuration_id=None, request_id=None)client.audio.voices.list(model, provider_configuration_id=None, request_id=None)
Audio Notes
client.audio.transcriptions.create(),client.audio.translations.create()andclient.audio.diarizations.create()upload audio asmultipart/form-data.client.audio.speech.create()returns raw bytes.- The gateway enforces runtime scopes:
audio:transcribeaudio:translateaudio:diarize(upload and live stream)audio:synthesis(speech and voice listing)
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.6.0.dev3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datalabrotterdam_nova_sdk-1.6.0.dev3.tar.gz | 12.4 kB | Without provenance | Details for datalabrotterdam_nova_sdk-1.6.0.dev3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datalabrotterdam_nova_sdk-1.6.0.dev3-py3-none-any.whl | Python 3 | none | any | Details for datalabrotterdam_nova_sdk-1.6.0.dev3-py3-none-any.whl |
Total release size: 23.9 kB
Release files / datalabrotterdam_nova_sdk-1.6.0.dev3.tar.gz
| Download URL | datalabrotterdam_nova_sdk-1.6.0.dev3.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1eb2aeb97fc5cd7059b55bde8c96c1b540bf71072303428b2e3e585e8a90fe53
|
|
BLAKE2b-256 checksum How to use checksums |
9dc0e962e40b834814d83d058b638bc87cc7725b5fdab4b6c903fce6b5b57566
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / datalabrotterdam_nova_sdk-1.6.0.dev3-py3-none-any.whl
| Download URL | datalabrotterdam_nova_sdk-1.6.0.dev3-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
230fb0c17f2690d8d495d6e0c453ca5d9fb047974ac1350d4d5e063b5f394df2
|
|
BLAKE2b-256 checksum How to use checksums |
13e51e6d866ddcbc78561a00d10b3531623dd611251c7954f646f664cb84189c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for datalabrotterdam-nova-sdk 1.6.0.dev3
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.