Callbacks & Credits Balance

V1.1.0

Callbacks

Introducing callbacks for dream machine api generations, one can pass a callback_url to the request body / create sdk function.

  • A POST request with Generationobject json as body will be called for the callback
  • Any and all the updates are sent (status, video url, failure reason)
  • If the API endpoint doesn't return a status code 200, we retry 3 times with 100ms delay and requests have a 5s timeout.
generation = await client.generations.create(
    prompt="A teddy bear in sunglasses playing electric guitar and dancing",
    callback_url="<your_api_endpoint_here>"
)

Credits Balance

Introducing the credits endpoint /dream-machine/v1/credits which returns credit_balance number which is in cents (USD). This is an endpoint one can call to understand if the account associated with the api has enough balance.

result = await self.client.credits.get()
balance = result.credit_balance

Note: Both callbacks and credits are available to use on API, Python SDK and JS/TS SDK.


How to upgrade SDKs

pip install lumaai --upgrade

npm install lumaai@latest