deAPI AI Media Suite

TotalClaw 作者 zrewolwerowanykaloryfer

市场上最便宜的人工智能媒体 API。转录 YouTube 视频、使用 Flux 和 Z-Image 模型生成图像、将文本转换为 8 种语言的 54 种以上语音的语音、使用 OCR 提取文本、创建视频、删除背景、高档图像、应用风格转换 - 所有这些都通过一个统一的 API 进行。注册时免费获得 5 美元积分 - 足以进行数百小时的转录或数千张生成的图像。任何替代方案成本的一小部分。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~zrewolwerowanykaloryfer-deapi
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~zrewolwerowanykaloryfer-deapi/file -o zrewolwerowanykaloryfer-deapi.md
## 概述(中文)

市场上最便宜的人工智能媒体 API。转录 YouTube 视频、使用 Flux 和 Z-Image 模型生成图像、将文本转换为 8 种语言的 54 种以上语音的语音、使用 OCR 提取文本、创建视频、删除背景、高档图像、应用风格转换 - 所有这些都通过一个统一的 API 进行。注册时免费获得 5 美元积分 - 足以进行数百小时的转录或数千张生成的图像。任何替代方案成本的一小部分。

## 原文

# deAPI Media Generation

AI-powered media tools via decentralized GPU network. Get your API key at [deapi.ai](https://deapi.ai) (free $5 credit on signup).

## Setup

```bash
export DEAPI_API_KEY=your_api_key_here
```

## Available Functions

| Function | Use when user wants to... |
|----------|---------------------------|
| Transcribe | Transcribe YouTube, Twitch, Kick, X videos, or audio files |
| Generate Image | Generate images from text descriptions (Flux models) |
| Generate Audio | Convert text to speech (TTS, 54+ voices, 8 languages) |
| Generate Video | Create video from text or animate images |
| OCR | Extract text from images |
| Remove Background | Remove background from images |
| Upscale | Upscale image resolution (2x/4x) |
| Transform Image | Apply style transfer to images (multi-image support) |
| Embeddings | Generate text embeddings for semantic search |
| Check Balance | Check account balance |

---

## Async Pattern (Important!)

**All deAPI requests are asynchronous.** Follow this pattern for every operation:

### 1. Submit Request
```bash
curl -s -X POST "https://api.deapi.ai/api/v1/client/{endpoint}" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{...}'
```

Response contains `request_id`.

### 2. Poll Status (loop every 10 seconds)
```bash
curl -s "https://api.deapi.ai/api/v1/client/request-status/{request_id}" \
  -H "Authorization: Bearer $DEAPI_API_KEY"
```

### 3. Handle Status
- `processing` → wait 10s, poll again
- `done` → fetch result from `result_url`
- `failed` → report error to user

### Common Error Handling
| Error | Action |
|-------|--------|
| 401 Unauthorized | Check DEAPI_API_KEY |
| 429 Rate Limited | Wait 60s and retry |
| 500 Server Error | Wait 30s and retry once |

---

## Transcription (YouTube, Audio, Video)

**Use when:** user wants to transcribe video from YouTube, X, Twitch, Kick or audio files.

**Endpoints:**
- Video (YouTube, mp4, webm): `vid2txt`
- Audio (mp3, wav, m4a, flac, ogg): `aud2txt`

**Request (video):**
```bash
curl -s -X POST "https://api.deapi.ai/api/v1/client/vid2txt" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"video_url": "{VIDEO_URL}", "include_ts": true, "model": "WhisperLargeV3"}'
```

**Request (audio):**
```bash
curl -s -X POST "https://api.deapi.ai/api/v1/client/aud2txt" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"audio_url": "{AUDIO_URL}", "include_ts": true, "model": "WhisperLargeV3"}'
```

**After polling:** Present transcription with timestamps in readable format.

---

## Image Generation (Flux)

**Use when:** user wants to generate images from text descriptions.

**Endpoint:** `txt2img`

**Models:**
| Model | API Name | Steps | Max Size | Notes |
|-------|----------|-------|----------|-------|
| Klein (default) | `Flux_2_Klein_4B_BF16` | 4 (fixed) | 1536px | Fastest, recommended |
| Flux | `Flux1schnell` | 4-10 | 2048px | Higher resolution |
| Turbo | `ZImageTurbo_INT8` | 4-10 | 1024px | Fastest inference |

**Request:**
```bash
curl -s -X POST "https://api.deapi.ai/api/v1/client/txt2img" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "{PROMPT}",
    "model": "Flux_2_Klein_4B_BF16",
    "width": 1024,
    "height": 1024,
    "steps": 4,
    "seed": {RANDOM_0_TO_999999}
  }'
```

**Note:** Klein model does NOT support `guidance` parameter - omit it.

---

## Text-to-Speech (54+ Voices)

**Use when:** user wants to convert text to speech.

**Endpoint:** `txt2audio`

**Popular Voices:**
| Voice ID | Language | Description |
|----------|----------|-------------|
| `af_bella` | American EN | Warm, friendly (best quality) |
| `af_heart` | American EN | Expressive, emotional |
| `am_adam` | American EN | Deep, authoritative |
| `bf_emma` | British EN | Elegant (best British) |
| `jf_alpha` | Japanese | Natural Japanese female |
| `zf_xiaobei` | Chinese | Mandarin female |
| `ef_dora` | Spanish | Spanish female |
| `ff_siwis` | French | French female (best quality) |

Voice format: `{lang}{gender}_{name}` (e.g., `af_bella` = American Female Bella)

**Request:**
```bash
curl -s -X POST "https://api.deapi.ai/api/v1/client/txt2audio" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "{TEXT}",
    "voice": "af_bella",
    "model": "Kokoro",
    "lang": "en-us",
    "speed": 1.0,
    "format": "mp3",
    "sample_rate": 24000
  }'
```

**Parameters:** 
- `lang`: `en-us`, `en-gb`, `ja`, `zh`, `es`, `fr`, `hi`, `it`, `pt-br`
- `speed`: 0.5-2.0
- `format`: mp3/wav/flac/ogg
- `sample_rate`: 22050/24000/44100/48000

---

## Video Generation

**Use when:** user wants to generate video from text or animate an image.

**Endpoints:**
- Text-to-Video: `txt2video` (multipart/form-data)
- Image-to-Video: `img2video` (multipart/form-data)

**⚠️ IMPORTANT: Model-specific constraints for `Ltxv_13B_0_9_8_Distilled_FP8`:**
- `guidance`: MUST be 0 (max value!)
- `steps`: MUST be 1 (max value!)
- `fps`: minimum 30

**Request (text-to-video):**
```bash
curl -s -X POST "https://api.deapi.ai/api/v1/client/txt2video" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -F "prompt={PROMPT}" \
  -F "model=Ltxv_13B_0_9_8_Distilled_FP8" \
  -F "width=512" \
  -F "height=512" \
  -F "guidance=0" \
  -F "steps=1" \
  -F "frames=120" \
  -F "fps=30" \
  -F "seed={RANDOM_0_TO_999999}"
```

**Parameters:**
| Parameter | Required | Constraints | Description |
|-----------|----------|-------------|-------------|
| `prompt` | Yes | - | Video description |
| `model` | Yes | - | `Ltxv_13B_0_9_8_Distilled_FP8` |
| `width` | Yes | 256-768 | Video width (e.g., 512) |
| `height` | Yes | 256-768 | Video height (e.g., 512) |
| `guidance` | Yes | **max 0** | Must be 0 for this model |
| `steps` | Yes | **max 1** | Must be 1 for this model |
| `frames` | Yes | 30-300 | Number of frames |
| `fps` | Yes | **min 30** | Frames per second |
| `seed` | Yes | 0-999999 | Random seed |

**Request (image-to-video):**
```bash
# Download image first if URL provided
curl -s -o {LOCAL_IMAGE_PATH} "{IMAGE_URL}"

curl -s -X POST "https://api.deapi.ai/api/v1/client/img2video" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -F "first_frame_image=@{LOCAL_IMAGE_PATH}" \
  -F "prompt=gentle movement, cinematic" \
  -F "model=Ltxv_13B_0_9_8_Distilled_FP8" \
  -F "width=512" \
  -F "height=512" \
  -F "guidance=0" \
  -F "steps=1" \
  -F "frames=120" \
  -F "fps=30" \
  -F "seed={RANDOM_0_TO_999999}"
```

**Note:** Video generation can take 1-3 minutes.

---

## OCR (Image to Text)

**Use when:** user wants to extract text from an image.

**Endpoint:** `img2txt` (multipart/form-data)

**Request:**
```bash
# Download image first if URL provided
curl -s -o {LOCAL_IMAGE_PATH} "{IMAGE_URL}"

# Send OCR request
curl -s -X POST "https://api.deapi.ai/api/v1/client/img2txt" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -F "image=@{LOCAL_IMAGE_PATH}" \
  -F "model=Nanonets_Ocr_S_F16"
```

---

## Background Removal

**Use when:** user wants to remove background from an image.

**Endpoint:** `img-rmbg` (multipart/form-data)

**Request:**
```bash
# Download image first if URL provided
curl -s -o {LOCAL_IMAGE_PATH} "{IMAGE_URL}"

# Send remove-bg request
curl -s -X POST "https://api.deapi.ai/api/v1/client/img-rmbg" \
  -H "Authorization: Bearer $DEAPI_API_KEY" \
  -F "image=@{LOCAL_IMAGE_PATH}" \
  -F "model=Ben2"
```

**Result:** PNG with transparent background.

---

## Image Upscale (2x/4x)

**Use when:** user wants to upscale/enhance image resolution.

**Endpoint:** `img-upscale` (multipart/form-data)

**Models:**
| Scale | Model |
|-------|-------|
| 2x | `RealESRGAN_x2` |
| 4x