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:
-
Header Authentication (Recommended)
Authorization: Bearer <your_api_key> -
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 Name | Type | Required | Description |
|---|---|---|---|
| orderType | string | Yes | Order type, see enum below |
| stuff | object | Yes | Material information |
| stuff.pathKey | string | Yes | Resource 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
| Field | Type | Description |
|---|---|---|
| orderNo | string | Order number, used for subsequent queries |
| orderType | string | Order type |
| orderStatus | string | Order status |
| payStatus | string | Payment status |
| messageId | string | Task 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 Name | Type | Required | Description |
|---|---|---|---|
| orderNo | string | Yes | Order 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
| Field | Type | Description |
|---|---|---|
| orderNo | string | Order number |
| orderType | string | Order type |
| status | string | Order status |
| cost | number | Consumed credits |
| reason | string | Failure reason (only when failed) |
| stuffs | array | Result list |
| stuffs[].name | string | File name |
| stuffs[].business | string | Business type (vocals/accompaniment/caption, etc.) |
| stuffs[].url | string | Download link (valid for 1 hour) |
| balance | number | Current 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 Name | Type | Required | Description |
|---|---|---|---|
| link | string | Yes | Short 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
| Field | Type | Description |
|---|---|---|
| title | string | Video title |
| author | string | Author nickname |
| cover | string | Cover image address |
| videoUrl | string | Watermark-free video download address |
| musicUrl | string | Background music download address (if any) |
| balance | number | Current user available credit balance |
Error Code Description
| Error Code | Description |
|---|---|
| 0 | Success |
| 400 | Request parameter error |
| 401 | Authentication failed (API Key invalid or missing) |
| 500 | Internal server error |
Common Error Messages
| Error Message | Description |
|---|---|
| API Key is required | API Key is required |
| Invalid API Key | API Key is invalid |
| pathKey is required | Resource address is required |
| Order not found | Order does not exist or does not belong to the current user |
| ErrorCode.USER_BLANCE_NOT_ENOUGH | Insufficient credit balance |
Appendix
OrderType (Order Type)
| Value | Description |
|---|---|
| track-separation | Track separation (separate vocal and accompaniment) |
| extract-voice | Extract voice |
| extract-music | Extract accompaniment |
| extract-text | Extract text |
OrderStatus (Order Status)
| Value | Description |
|---|---|
| pending | Pending |
| processing | Processing |
| finish | Finish |
| failed | Failed |
| timeout | Timeout |
Supported Short Video Platforms
- Douyin
- Kuaishou
- Xiaohongshu
- And other mainstream short video platforms