Skip to content
dhanu docs
Browse pages

SDKs

Examples

Runnable Node and Python samples, check a key, generate text and images, create a task, embed, render a video, receive webhooks, kept green by CI against test-mode fixtures.

The examples/ directory of the Dhanu repository holds one file per thing you might do with the API, in Node and in Python:

ExampleNodePython
Check the key and generate textquickstart.tsquickstart.py
Generate an image and save itgenerate-an-image.tsgenerate_an_image.py
Create a task, send a message, read the threadcreate-a-task.tscreate_a_task.py
Embed texts and compare themembeddings.tsembeddings.py
Render a video, wait for the job, download itgenerate-a-video.tsgenerate_a_video.py
Receive and verify webhookswebhook-server.tswebhook_server.py

Every example runs against whatever key is in DHANU_API_KEY. With a test key each call answers with fixtures and spends nothing, which is how CI runs the whole set on every change, so a sample that stops matching the API cannot ship.

export DHANU_API_KEY=dhanu_sk_test_…
pnpm --filter dhanu-examples-node exec tsx quickstart.ts
python examples/python/quickstart.py

Each file is written to be copied: a client() helper reads the key, main() does one thing, and the webhook servers verify Dhanu-Signature with the SDK helper so you can forward real deliveries to them with dhanu webhooks listen.