所有 API 请求都需要在 Authorization 请求头中携带 Bearer 令牌。您可以在仪表盘中管理 API 密钥。
http
1
Authorization: Bearer aio_your_api_key_here
获取您的 API 密钥: 在仪表盘的 API 密钥页面创建免费 API 密钥。新账户将获得赠送额度以探索平台。
基础 URL
https://apiin.one/api/v1
API 端点
Click each endpoint to see full parameter details, example requests, and response format.
POST/api/v1/images/generationsImage generation
Generate images using AI models. Specify the model in the request body. The model field determines which image generation engine is used. Returns a task_id for async polling.
Request Body Parameters
Body ParametersJSON
model:string
Model slug. See Supported Models below for available options.
prompt:string
Text description of the image to generate (3–5000 chars)
aspect_ratio:optional string
Output aspect ratio (e.g. 1:1, 16:9, 9:16) Defaults to 1:1.
type:optional string
Generation mode. Model-specific, e.g. pro/flex for Flux 2, text-to-image/edit for Seedream
resolution:optional string
Output resolution. Model-specific, e.g. 1K/2K for Flux 2
quality:optional string
Quality level. Model-specific, e.g. medium/high for GPT Image
input_urls:optional array
Array of image URLs for image-to-image or editing mode
negative_prompt:optional string
Elements to avoid in the generated image (not all models support this)
seed:optional number
Random seed for reproducibility (not all models support this)
curl-X POST https://apiin.one/api/v1/images/generations\
2
-H"Authorization: Bearer aio_your_api_key"\
3
-H"Content-Type: application/json"\
4
-d '{
5
"model": "flux-2",
6
"prompt": "A serene Japanese garden with cherry blossoms",
7
"aspect_ratio": "16:9",
8
"type": "pro",
9
"resolution": "1K"
10
}'
Example Response
json
1
{
2
"code": 200,
3
"message": "success",
4
"data": {
5
"task_id": "n41xxxx_flux2",
6
"status": "IN_PROGRESS"
7
}
8
}
POST/api/v1/videos/generationsVideo generation
Generate videos using AI models. Supports text-to-video and image-to-video. The model field determines which video engine is used. Returns a task_id for async polling.
Request Body Parameters
Body ParametersJSON
model:string
Model slug. See Supported Models below for available options.
prompt:string
Text description of the video (max 2500 chars for most models)
image:optional string
Image URL for image-to-video mode. Auto-detected by most models.
mode:optional string
Quality mode. Model-specific, e.g. std/pro for Kling 3
duration:optional number | string
Video duration in seconds. Model-specific (Kling 3: 3–15s, others vary) Defaults to 5.
aspect_ratio:optional string
Output aspect ratio (1:1, 9:16, 16:9) Defaults to 16:9.
resolution:optional string
Output resolution. Model-specific, e.g. 480p, 720p, 1080p
sound:optional boolean
Enable audio generation in the video (Kling 3) Defaults to true.
generateAudio:optional boolean
Enable audio generation (Seedance) Defaults to false.
generate_audio_switch:optional boolean
Enable audio generation (PixVerse) Defaults to false.
curl-X POST https://apiin.one/api/v1/videos/generations\
2
-H"Authorization: Bearer aio_your_api_key"\
3
-H"Content-Type: application/json"\
4
-d '{
5
"model": "kling-3",
6
"prompt": "A golden retriever running through sunflowers at sunset",
7
"mode": "std",
8
"duration": 5,
9
"aspect_ratio": "16:9",
10
"sound": true
11
}'
Example Response
json
1
{
2
"code": 200,
3
"message": "success",
4
"data": {
5
"task_id": "n75xxxx_kling3",
6
"status": "IN_PROGRESS"
7
}
8
}
POST/api/v1/audio/musicMusic generation
Generate original music from text descriptions. Suno supports both "inspiration mode" (text description) and "custom mode" (lyrics + style + title). MiniMax Music supports lyrics-driven generation. Returns a task_id for async polling.
Request Body Parameters
Body ParametersJSON
model:string
Model: suno (defaults to chirp-v3-5) or minimax-music
prompt:optional string
Lyrics (Suno custom mode) or style description (MiniMax). Max 3000 chars for Suno v3.5/v4, 5000 for v4.5+.
gpt_description_prompt:optional string
Text description for Suno inspiration mode. Max 400 chars.
style:optional string
Musical style/genre (Suno custom mode). Max 1000 chars.
title:optional string
Song title (Suno). Max 80 characters.
make_instrumental:optional boolean
Generate instrumental only, no vocals (Suno) Defaults to false.
"prompt": "Verse 1: Walking down the street\nChorus: Summer dreams",
7
"style": "pop, upbeat, electronic",
8
"title": "Summer Dreams",
9
"make_instrumental": false
10
}'
Example Response
json
1
{
2
"code": 200,
3
"message": "success",
4
"data": {
5
"task_id": "n7xxxx_suno",
6
"status": "IN_PROGRESS"
7
}
8
}
POST/api/v1/audio/speechText to speech
Convert text to natural-sounding multi-voice dialogue speech using ElevenLabs V3. Supports 30+ languages and automatic language detection. Returns a task_id for async polling.
Request Body Parameters
Body ParametersJSON
model:string
Model slug: elevenlabs-v3
dialogue:array
Array of dialogue items: [{text: ..., voice: ...}]. Voice is optional.
stability:optional number
Voice stability (0–1). Lower = more variation, higher = more consistent. Defaults to 0.5.
language_code:optional string
Language code (e.g. en, zh, ja) or auto for detection Defaults to auto.
curl-X POST https://apiin.one/api/v1/audio/speech\
2
-H"Authorization: Bearer aio_your_api_key"\
3
-H"Content-Type: application/json"\
4
-d '{
5
"model": "elevenlabs-v3",
6
"dialogue": [
7
{"text": "Hello, welcome to API in One.", "voice": "narrator"},
8
{"text": "Thank you! Tell me more.", "voice": "user"}
9
],
10
"stability": 0.5,
11
"language_code": "auto"
12
}'
Example Response
json
1
{
2
"code": 200,
3
"message": "success",
4
"data": {
5
"task_id": "n58xxxx_tts",
6
"status": "IN_PROGRESS"
7
}
8
}
POST/api/v1/chat/completionsChat / LLM
Chat completions in OpenAI-compatible format. Supports SSE streaming by default. Powered by Gemini (defaults to Gemini 3 Flash). Returns a synchronous or streamed response (not async task).
Request Body Parameters
Body ParametersJSON
model:string
Model slug: gemini. Backend defaults to Gemini 3 Flash.
messages:array
Array of message objects: [{role: user|assistant|system|developer, content: ...}]
stream:optional boolean
Enable SSE streaming. Responses are sent as Server-Sent Events. Defaults to true.
include_thoughts:optional boolean
Include model reasoning/thinking steps in response Defaults to true.
reasoning_effort:optional string
Reasoning depth: low or high Defaults to high.
tools:optional array
Array of tool definitions for function calling (OpenAI-compatible format)
response_format:optional object
Force structured output format (e.g. {type: json_object})
Remove image backgrounds instantly with AI precision. No model field required. 1 credit per image. Returns a task_id for async polling.
Request Body Parameters
Body ParametersJSON
image:string
URL of the image to remove background from
Example Request
bash
1
curl-X POST https://apiin.one/api/v1/images/tools/remove-bg\
2
-H"Authorization: Bearer aio_your_api_key"\
3
-H"Content-Type: application/json"\
4
-d '{
5
"image": "https://example.com/photo.jpg"
6
}'
Example Response
json
1
{
2
"code": 200,
3
"message": "success",
4
"data": {
5
"task_id": "n19xxxx_bgremove"
6
}
7
}
POST/api/v1/images/tools/face-swapFace swap
Swap faces in images with natural-looking results. Requires a target image (body/scene) and a source face image. 4 credits per swap. Returns a task_id for async polling.
Request Body Parameters
Body ParametersJSON
image:string
URL of the target image (the body/scene to modify)
face_image:string
URL of the source face image (the face to swap in)
target_index:optional number
Face index in target image if multiple faces detected (0–10) Defaults to 0.
output_format:optional string
Output format: jpeg, png, or webp Defaults to jpeg.
Example Request
bash
1
curl-X POST https://apiin.one/api/v1/images/tools/face-swap\
Remove or replace video backgrounds with AI. Supports optional custom background image replacement. 10 credits per video. Returns a task_id for async polling.
Request Body Parameters
Body ParametersJSON
video:string
URL of the video to process
background_image:optional string
URL of a custom background image to replace with
Example Request
bash
1
curl-X POST https://apiin.one/api/v1/videos/tools/bg-remover\
2
-H"Authorization: Bearer aio_your_api_key"\
3
-H"Content-Type: application/json"\
4
-d '{
5
"video": "https://example.com/talking-head.mp4"
6
}'
Example Response
json
1
{
2
"code": 200,
3
"message": "success",
4
"data": {
5
"task_id": "n53xxxx_vbgr",
6
"status": "IN_PROGRESS"
7
}
8
}
GET/api/v1/tasks/{task_id}Check task status
Poll the status of any asynchronous generation task. The task_id is returned by all generation endpoints (except chat/completions). Poll until status is "SUCCESS" or "FAILED".
Request Body Parameters
Body ParametersJSON
task_id:string (path)
The task ID returned by the generation endpoint (e.g. n41xxxx_flux2)
Example Request
bash
1
curlhttps://apiin.one/api/v1/tasks/n41xxxx_flux2\
2
-H"Authorization: Bearer aio_your_api_key"
Example Response
json
1
{
2
"code": 200,
3
"message": "success",
4
"data": {
5
"task_id": "n41xxxx_flux2",
6
"status": "SUCCESS",
7
"consumed_credits": 5,
8
"error_message": null,
9
"created_at": "2026-02-25T12:00:00Z",
10
"request": {
11
"model": "flux-2",
12
"prompt": "A serene Japanese garden..."
13
},
14
"response": [
15
"https://cdn.example.com/generated-image.png"
16
]
17
}
18
}
请求格式
所有请求使用 JSON 请求体,必须包含 'model' 字段来指定使用哪个 AI 模型。其他参数因模型而异。
json
1
{
2
"model": "flux-2",
3
"prompt": "A beautiful landscape",
4
"...other_params": "..."
5
}
'model' 参数始终是必需的。请访问每个模型的文档页面查看完整的支持参数列表。
响应格式
异步任务(图像、视频、音乐、语音)
对于内容生成模型,API 会立即返回一个任务 ID。通过轮询状态端点来查看任务是否完成。
Initial response when task is created.
1
{
2
"id": "task_abc123",
3
"status": "pending",
4
"model": "kling-3",
5
"created_at": "2026-02-24T12:00:00Z"
6
}
同步响应(对话)
对话补全会在单个请求中直接返回响应,遵循 OpenAI 兼容格式。
json
1
{
2
"id": "chatcmpl_xyz",
3
"model": "gemini",
4
"choices": [
5
{
6
"message": {
7
"role": "assistant",
8
"content": "..."
9
}
10
}
11
],
12
"usage": {
13
"prompt_tokens": 12,
14
"completion_tokens": 156,
15
"total_tokens": 168
16
},
17
"credits_consumed": 2
18
}
错误处理
endpoints_desc
json
1
{
2
"error": {
3
"code": 401,
4
"message": "Invalid API key",
5
"type": "authentication_error"
6
}
7
}
Body ParametersJSON
400:optional invalid_request
请求参数无效。请查看模型文档了解必填字段。
401:optional authentication_error
API 密钥缺失、无效或已吊销。
402:optional insufficient_credits
账户额度不足。请购买更多额度以继续使用。
404:optional not_found
未找到请求的资源(任务、模型)。
429:optional rate_limit
超出速率限制。默认为每分钟 60 个请求。
500:optional server_error
服务器内部错误。请稍后重试。
快速开始
1. 获取 API 密钥
注册并在仪表盘中创建 API 密钥。免费账户包含赠送额度。
2. 发送第一个请求
bash
1
curl-X POST https://apiin.one/api/v1/images/generations\
2
-H"Authorization: Bearer aio_your_key"\
3
-H"Content-Type: application/json"\
4
-d '{
5
"model": "flux-2",
6
"prompt": "A serene Japanese garden with cherry blossoms"