All Integrations

Dify Integration

Connect NextAPI as a custom tool in Dify to add video generation capabilities to your AI applications. Dify's OpenAPI tool system lets you define external API endpoints that agents can call — no plugin required.

Configuration

Set the following values in your Dify configuration:

yaml
# Dify Custom Tool Schema
openapi: "3.0"
info:
  title: NextAPI Video Generation
  version: "1.0"
servers:
  - url: https://api.nextapi.top
paths:
  /v1/videos:
    post:
      operationId: generateVideo
      summary: Generate an AI video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [model, input]
              properties:
                model:
                  type: string
                  default: seedance-2.0-pro
                input:
                  type: object
                  required: [prompt]
                  properties:
                    prompt:
                      type: string
                    duration_seconds:
                      type: integer
                      default: 6
                    resolution:
                      type: string
                      default: "1080p"
      responses:
        "202":
          description: Video task created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  status:
                    type: string
                  estimated_cost_cents:
                    type: integer
  /v1/videos/{id}:
    get:
      operationId: getVideo
      summary: Get an AI video task result
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Video task status
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  status:
                    type: string
                    enum: [queued, running, succeeded, failed]
                  output:
                    type: object
                    properties:
                      url:
                        type: string
                      video_url:
                        type: string
                  error:
                    type: string

Setup Steps

  1. 1In Dify Studio, navigate to Tools > Custom and click "Create Custom Tool".
  2. 2Paste the OpenAPI schema above into the schema editor.
  3. 3Configure the authentication: select "API Key" and set the header to "Authorization" with prefix "Bearer".
  4. 4Enter your NextAPI API key and save the tool.
  5. 5In your Dify app, add both the generateVideo and getVideo tools to the workflow or agent toolset.
  6. 6First call generateVideo, save the returned id, then call getVideo until status is succeeded.
  7. 7Only return output.url or output.video_url to the user after the query tool reports success.

Test with cURL

Verify your setup by running this command with your real sk_live_ key:

Sample command — replace $NEXTAPI_KEY with your actual key from app.nextapi.top.
bash
CREATE_RESPONSE=$(curl -sS -X POST https://api.nextapi.top/v1/videos \
  -H "Authorization: Bearer $NEXTAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2.0-pro",
    "input": {
      "prompt": "aerial view of a city at sunset",
      "duration_seconds": 6,
      "resolution": "1080p"
    }
  }')

VIDEO_ID=$(printf '%s' "$CREATE_RESPONSE" | jq -r '.id')

curl -sS "https://api.nextapi.top/v1/videos/$VIDEO_ID" \
  -H "Authorization: Bearer $NEXTAPI_KEY"
For complete setup details including polling, error handling, and security best practices, refer to the third-party tools configuration guide in the NextAPI documentation.

Need help?

Contact our integrations team at support@nextapi.top or check the full API documentation.