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:
| Example | Node | Python |
|---|---|---|
| Check the key and generate text | quickstart.ts | quickstart.py |
| Generate an image and save it | generate-an-image.ts | generate_an_image.py |
| Create a task, send a message, read the thread | create-a-task.ts | create_a_task.py |
| Embed texts and compare them | embeddings.ts | embeddings.py |
| Render a video, wait for the job, download it | generate-a-video.ts | generate_a_video.py |
| Receive and verify webhooks | webhook-server.ts | webhook_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.