v1

API Documentation

音子AI开放平台 API 文档,提供完整的接口说明和使用示例

文档说明

本文档描述了音子AI开放平台 API 的使用方法。开发者可以通过 API 进行订单创建、查询等操作。 所有接口均需要通过 apiKey 进行鉴权。

Open Platform API Documentation (v1)

This document describes how to use the YinziAI Open Platform API. Developers can use the API to create orders, query status, and more.

Authentication

All interfaces require authentication via apiKey. The system identifies the user based on the apiKey, without relying on Session or Token. You can get your key in "User Center" -> "API Key".

Two authentication methods are supported:

  1. Header Authentication (Recommended)

    Authorization: Bearer <your_api_key>
    
  2. Query Parameter Authentication

    ?apiKey=<your_api_key>
    

Base URL

https://api.yinziai.com

Interface List

1. Create Order

Create an asynchronous processing order. The system will automatically generate an order number and return it.

Note: When an order is submitted, the system first holds the minimum credits for that order type. After completion, credits are settled based on the actual usage, with any difference refunded or charged.

  • URL: /api/open/v1/order/create
  • Method: POST
  • Content-Type: application/json

Request Parameters

Parameter NameTypeRequiredDescription
orderTypestringYesOrder type, see enum below
stuffobjectYesMaterial information
stuff.pathKeystringYesResource address (supports HTTP link)

Request Examples

Track Separation (track-separation)

Separate audio into vocal and accompaniment tracks.

{
  "orderType": "track-separation",
  "stuff": {
    "pathKey": "https://example.com/audio.mp3"
  }
}

Extract Voice (extract-voice)

Extract the vocal part from the audio.

{
  "orderType": "extract-voice",
  "stuff": {
    "pathKey": "https://example.com/audio.mp3"
  }
}

Extract Music (extract-music)

Extract the accompaniment/background music part from the audio.

{
  "orderType": "extract-music",
  "stuff": {
    "pathKey": "https://example.com/audio.mp3"
  }
}

Extract Text (extract-text)

Extract text content from video or audio.

{
  "orderType": "extract-text",
  "stuff": {
    "pathKey": "https://example.com/video.mp4"
  }
}

Response Example

{
  "code": 0,
  "data": {
    "orderNo": "abc123XYZ789defGHI",
    "orderType": "track-separation",
    "orderStatus": "processing",
    "payStatus": "waiting",
    "messageId": "task-id-123"
  },
  "msg": "success"
}

Response Field Description

FieldTypeDescription
orderNostringOrder number, used for subsequent queries
orderTypestringOrder type
orderStatusstringOrder status
payStatusstringPayment status
messageIdstringTask Message ID

2. Query Order

Query the processing status and result of the order. After the order is processed, the download link for the result will be returned.

  • URL: /api/open/v1/order/query
  • Method: GET

Request Parameters

Parameter NameTypeRequiredDescription
orderNostringYesOrder number

Request Example

GET /api/open/v1/order/query?orderNo=abc123XYZ789defGHI
Authorization: Bearer <your_api_key>

Response Example (Processing)

{
  "code": 0,
  "data": {
    "orderNo": "abc123XYZ789defGHI",
    "orderType": "track-separation",
    "status": "processing",
    "cost": 0,
    "reason": null,
    "stuffs": [],
    "balance": 1000
  },
  "msg": "success"
}

Response Example (Finished)

{
  "code": 0,
  "data": {
    "orderNo": "abc123XYZ789defGHI",
    "orderType": "track-separation",
    "status": "finish",
    "cost": 10,
    "reason": null,
    "stuffs": [
      {
        "name": "vocals.mp3",
        "business": "vocals",
        "url": "https://cdn.example.com/result/vocals.mp3"
      },
      {
        "name": "accompaniment.mp3",
        "business": "accompaniment",
        "url": "https://cdn.example.com/result/accompaniment.mp3"
      }
    ],
    "balance": 990
  },
  "msg": "success"
}

Response Field Description

FieldTypeDescription
orderNostringOrder number
orderTypestringOrder type
statusstringOrder status
costnumberConsumed credits
reasonstringFailure reason (only when failed)
stuffsarrayResult list
stuffs[].namestringFile name
stuffs[].businessstringBusiness type (vocals/accompaniment/caption, etc.)
stuffs[].urlstringDownload link (valid for 1 hour)
balancenumberCurrent user available credit balance

3. Short Video Analyze

Real-time analysis of short video sharing links to get video information and watermark-free download addresses.

Note: This interface is a real-time interface, which will immediately deduct credits and return the result.

  • URL: /api/open/v1/short-video/analyze
  • Method: POST
  • Content-Type: application/json

Request Parameters

Parameter NameTypeRequiredDescription
linkstringYesShort video sharing link

Request Example

{
  "link": "https://v.douyin.com/ixxxxxx/"
}

Response Example

{
  "code": 0,
  "data": {
    "title": "Video Title",
    "author": "Author Nickname",
    "cover": "https://cdn.example.com/cover.jpg",
    "videoUrl": "https://cdn.example.com/video.mp4",
    "musicUrl": "https://cdn.example.com/music.mp3",
    "balance": 990
  },
  "msg": "success"
}

Response Field Description

FieldTypeDescription
titlestringVideo title
authorstringAuthor nickname
coverstringCover image address
videoUrlstringWatermark-free video download address
musicUrlstringBackground music download address (if any)
balancenumberCurrent user available credit balance

Error Code Description

Error CodeDescription
0Success
400Request parameter error
401Authentication failed (API Key invalid or missing)
500Internal server error

Common Error Messages

Error MessageDescription
API Key is requiredAPI Key is required
Invalid API KeyAPI Key is invalid
pathKey is requiredResource address is required
Order not foundOrder does not exist or does not belong to the current user
ErrorCode.USER_BLANCE_NOT_ENOUGHInsufficient credit balance

Appendix

OrderType (Order Type)

ValueDescription
track-separationTrack separation (separate vocal and accompaniment)
extract-voiceExtract voice
extract-musicExtract accompaniment
extract-textExtract text

OrderStatus (Order Status)

ValueDescription
pendingPending
processingProcessing
finishFinish
failedFailed
timeoutTimeout

Supported Short Video Platforms

  • Douyin
  • Kuaishou
  • Xiaohongshu
  • Weibo
  • And other mainstream short video platforms
API 文档版本: v1
如果您有任何问题,请参考文档或联系技术支持。