Skip to main content

zerogpu-sdk (Python SDK)

Official Python client for the ZeroGPU API: responses, chat completions, moderations, embeddings, and audio (transcriptions and speech), authenticated with your API key (x-api-key header). Published from ZeroGPU API SDKs (pypi/ in that repository).

Install

pip install zerogpu-sdk

Quick start — Responses

input may be a string or a list of message dicts / InputMessage, depending on the model.

import os
from zerogpu import ZerogpuApi

client = ZerogpuApi(
    api_key=os.environ["ZEROGPU_API_KEY"],
)

response = client.responses.create_response(
    model="zlm-v1-followup-questions-edge",
    input="In one short sentence, what is a habit tracker?",
    text={"format": {"type": "text"}},
)
print(response)

Optional metadata (Responses)

client.responses.create_response(
    model="gliner-multi-pii-v1",
    input="Your text…",
    metadata={"mask": "label", "usecase": "redact"},
)

Chat completions

from zerogpu import ChatMessage

client.chat.create_chat_completion(
    model="gliner-multi-pii-v1",
    messages=[ChatMessage(role="user", content="Your text…")],
    metadata={"mask": "label", "usecase": "redact"},
)

Moderations

Classify text against OpenAI's 13 safety categories. model defaults to zlm-v1-moderation-edge.

moderation = client.moderations.create_moderation(input="I want to hurt them.")
print(moderation.results[0].flagged, moderation.results[0].categories)

Embeddings

384-dimensional vectors from all-minilm-l6-v2 or bge-small-en-v1.5. Pass a list to embed a batch.

embeddings = client.embeddings.create_embedding(
    model="all-minilm-l6-v2",
    input=["first document", "second document"],
)
print(embeddings.data[0].embedding)

Audio

Transcribe with whisper-tiny. json (default) and verbose_json return a TranscriptionResponse; text, srt, and vtt return a string.

with open("speech.mp3", "rb") as f:
    transcript = client.audio.create_transcription(file=f)
print(transcript.text)

Generate speech with chatterbox-nano; the result is the audio bytes. Pass voice_sample to clone a voice from a reference clip.

audio = client.audio.create_speech(input="Hey, how are you today?", response_format="mp3")
with open("speech.mp3", "wb") as f:
    f.write(audio)

Every client has an async twin: AsyncZerogpuApi exposes the same methods with await.

API reference

Repository

Source and release workflow: github.com/zerogpu/SDK (Python package lives under pypi/).

Metadata

Release files for zerogpu-sdk 1.0.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 zerogpu-sdk 1.0.0
File Size Uploaded
zerogpu_sdk-1.0.0.tar.gz 36.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zerogpu-sdk 1.0.0
File Interpreter ABI Platform
zerogpu_sdk-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 105.1 kB

Release files / zerogpu_sdk-1.0.0.tar.gz

Download URL zerogpu_sdk-1.0.0.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
159f3e37b706a12acd550b9ecebbaedc03aee498024cb9d7453ee1f2284c964a
BLAKE2b-256 checksum
How to use checksums
ac0be010489202b196d3866186d983024d53a572e3934d0756c0c2dcddb25258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / zerogpu_sdk-1.0.0-py3-none-any.whl

Download URL zerogpu_sdk-1.0.0-py3-none-any.whl
Size 68.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b46cddbe2d4ba21a3fc61343defef78cfd9c60598ac5cdacda09e175a476d5d7
BLAKE2b-256 checksum
How to use checksums
2ce299ecf5dc923a947b91b0db0ab214d04828336da67ea739629fd90f096e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.0.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