Skip to content

zerogpu/zerogpu-api-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZeroGPU

ZeroGPU API SDKs

Official API clients for ZeroGPU.
Call POST /v1/responses and POST /v1/chat/completions with typed helpers — publishable packages on npm (zerogpu-api) and PyPI (pip install zerogpu-api → import zerogpu).

Open ZeroGPU platform   Open ZeroGPU website   ZeroGPU documentation

GitHub stars npm version PyPI version License ZeroGPU Router

ZeroGPU API SDKs — dashboard and integration preview


ZeroGPU API SDKs are the official API client libraries for ZeroGPU. Use them to call POST /v1/responses with your API key and project id.

API reference and guides: docs.zerogpu.ai (authentication, models, error codes).

Languages

Clients live under sdks/:

Directory Language
sdks/typescript TypeScript / JavaScript
sdks/python Python
sdks/go Go
sdks/ruby Ruby
sdks/java Java
sdks/rust Rust
sdks/csharp C# / .NET
sdks/php/sdk PHP
sdks/swift/sdk Swift

When you publish packages to npm, PyPI, crates.io, etc., point users at those registries and docs.zerogpu.ai; most developers do not need the internals of the ZeroGPU API SDKs repository.

Quick start (local checkout)

Environment variables (same as the dashboard snippets):

  • ZEROGPU_API_KEY
  • ZEROGPU_PROJECT_ID

Clients always use the production API base URL https://api.zerogpu.ai/v1. There is no environment variable to change it.

Smoke tests — one live POST /v1/responses per generated SDK; see smoke/README.md. TypeScript example:

cd smoke/typescript
npm install
export ZEROGPU_API_KEY=…
export ZEROGPU_PROJECT_ID=…
export ZEROGPU_MODEL=…   # from your dashboard
npm run smoke

Go uses the repo go.work so builds resolve the sdk module; from the Fern SDK directory run go run -C smoke/go . (after exporting the same variables).

Do not commit secrets.

input shape (OpenAPI + SDKs)

The OpenAPI spec models input as either a non-empty string or a non-empty array of role / content messages, matching what production accepts. Regenerate clients with Fern after changing specs/zerogpu.openapi.yaml.

POST /v1/responses (reminder)

  • Production base URL: https://api.zerogpu.ai/v1
  • Path: /responses
  • Headers: x-api-key, x-project-id, content-type: application/json

Full spec: Responses API.

Also supported in the generated clients: POST /v1/chat/completions via client.chat (Python: client.chat) for models that use the chat-completions route. Optional metadata on POST /v1/responses is included in CreateResponseRequest for model-specific options (e.g. PII).


For maintainers: regenerating clients

SDKs are generated from specs/zerogpu.openapi.yaml using Fern. To update or rebuild:

  1. Edit the OpenAPI file if the API changed.
  2. Run npx fern-api check from the fern/ directory (or repo root with paths adjusted).
  3. Run npx fern-api generate (after fern login or with FERN_TOKEN). Generator groups and output paths are in fern/generators.yml.

See Fern’s SDK quickstart for CLI install details.

Publishing to npm and PyPI (recommended)

ZeroGPU API SDKs ship standalone packages that do not rely on Fern’s paid registry flow:

Path Registry Package name (change if taken)
npm/ npmjs.com zerogpu-api (see npm/package.json)
pypi/ PyPI zerogpu-apipip install zerogpu-api imports zerogpu

npm

cd npm
npm install
npm run build
npm publish --access public

PyPI — use a venv and PyPI API token:

./scripts/sync-pypi-from-sdks.sh   # after `fern generate` updates sdks/python
cd pypi
python -m venv .venv && . .venv/bin/activate
pip install build twine
python -m build
twine upload dist/*

After regenerating Python with Fern, run sync-pypi-from-sdks.sh so pypi/src/zerogpu stays in sync with sdks/python.

Optional: Fern can also publish directly from generators.yml (npm, PyPI); you don’t need that if you use npm/ and pypi/ above.

Repository layout

Path Description
specs/zerogpu.openapi.yaml API definition used for generation
fern/ Fern configuration
sdks/ Generated output (do not hand-edit; regenerate)
npm/ npm package (tsup bundles sdks/typescript)
pypi/ PyPI package (src/zerogpu synced from sdks/python)
scripts/sync-pypi-from-sdks.sh Refresh Python package after Fern regen
go.work Go workspace linking sdks/go and smoke/go for smoke runs
smoke/ Live-request smoke tests per SDK (see smoke/README.md)

License

Add a root LICENSE when you publish; align it with packages you ship to npm, PyPI, etc.

About

ZeroGPU API SDKs are the official API client libraries for ZeroGPU. Use them to call POST /v1/responses with your API key and project id.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors