> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deepshi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Deepshi API is an OpenAI-compatible gateway. Base URL: https://api.deepshi.ai/v1. API keys start with sk-bf- and go in the Authorization: Bearer header. Prefer the official OpenAI SDKs pointed at the Deepshi base URL. Model ids are clean with no provider prefix (e.g. deepshi-3.0, claude-opus-4.8, gpt-5.5). Chat and image requests are synchronous; video and music requests are asynchronous job APIs (create, then poll). Every synchronous response carries usage.cost.total_cost in USD. Do not reference the internal /api/* admin plane or virtual keys.

# n8n

> Automate image, video, and music generation with n8n's HTTP Request node.

[n8n](https://n8n.io/) has no Deepshi-specific node, but its **HTTP Request** node calls any endpoint, so you can generate images, video, and music from a workflow. This is also the cleanest way to drive the asynchronous video and music job APIs.

## Set up the credential

Create a **Header Auth** credential once and reuse it on every node:

* **Name:** `Authorization`
* **Value:** `Bearer YOUR_DEEPSHI_API_KEY`

## Image generation (synchronous)

Add an **HTTP Request** node:

* **Method:** `POST`
* **URL:** `https://api.deepshi.ai/v1/images/generations`
* **Authentication:** your Header Auth credential
* **Body:** JSON, for example `{ "model": "deepshi-banana-pro", "prompt": "a red fox in a snowy forest", "width": 1024, "height": 1024 }`

The response returns the image in `data[0]` as a URL or base64, plus `usage.cost`.

Sizing parameters differ by model: some take `width` and `height` (like `deepshi-banana-pro`), others take `image_size` or `aspect_ratio` and `resolution`. Call `GET /v1/models` (or see the [image models](/models/image-models) page) for the exact parameters each model accepts, and send those in the body.

## Video and music (asynchronous)

Video (`/v1/videos`) and music (`/v1/audio/generations`) are job APIs: you create a job, then poll it until it finishes. Model it as a small loop of three nodes.

<Steps>
  <Step title="Create the job">
    An **HTTP Request** node: `POST https://api.deepshi.ai/v1/videos` (or `/v1/audio/generations`) with the JSON body. Keep the returned `id`.
  </Step>

  <Step title="Wait">
    A **Wait** node set to a few seconds. Jobs take from seconds to a few minutes.
  </Step>

  <Step title="Poll, then branch">
    An **HTTP Request** node: `GET https://api.deepshi.ai/v1/videos/{{ $json.id }}`. Feed it into an **IF** node: if `status` is `completed` or `failed`, continue; otherwise loop back to the Wait node.
  </Step>
</Steps>

On completion the result URL is in `videos[0].url` (video) or `audio[0].url` (music). A job that fails or is cancelled is never charged.

<Tip>
  For a heavier workload, replace the poll loop with a scheduled workflow that
  checks pending job ids, so one long render does not hold a workflow open.
</Tip>
