API Integration Guide

Ecomdy API Documentation

Guide to connecting BytePlus ModelArk models via standard OpenAI API format.

1. Quickstart Guide

APIDY AI Gateway is 100% compatible with official OpenAI SDKs (`openai` Python package, `openai` npm module). Simply install the standard OpenAI library and update your Base URL.

Standard OpenAI SDK Integration
from openai import OpenAI

# Instant BytePlus GLM-5.2 integration via APIDY AI Gateway
client = OpenAI(
    base_url="https://apidy.org/api/v1",
    api_key="sk-bp-your-api-key"  # API Key from APIDY Console
)

response = client.chat.completions.create(
    model="glm-5.2",
    messages=[{"role": "user", "content": "Hello! Write a 15s TikTok Ads script for a new product."}],
    stream=True
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

2. API Key Authentication

All HTTP requests to APIDY Gateway must include the Authorization header:

Authorization: Bearer sk-bp-xxx

You can create and manage your API Keys inside the Console Dashboard.

3. Tool Integrations & MCP Server (Cursor, Claude, MCP)

Select your preferred AI coding tool or chatbot interface below to view setup instructions and screenshots.

100% OpenAI & Anthropic Standard Compatible

Apidy provides drop-in compatibility. Simply change your Base URL and API Key to start coding with any AI agent.

Base URL:https://apidy.org/api/v1
Select Integration Target:

🖥️Cursor IDE Configuration Guide

Use Dola-Seed-2.1-Turbo or GLM-5.2 for code generation, refactoring, and debugging in Cursor.

1

Open Cursor Settings

Nhấn phím Ctrl + Shift + J (Windows) hoặc Cmd + Shift + J (Mac) và chọn tab Models.

2

Enable OpenAI API Key & Override URL

Bật công tắc OpenAI API Key, bấm Override OpenAI Base URL và dán:

https://apidy.org/api/v1
3

Enter Apidy API Key

Dán khóa API Key của bạn (định dạng sk-bp-...) lấy từ mục Console Keys.

4

Add Model Names

Trong mục Model Names, bấm + Add Model và thêm các mã sau:

dola-seed-2.1-turboRecommended
dola-seed-2.0-miniFast & Cheap
glm-5.2Z.AI Flagship
Cursor Settings — Models
OpenAI Protocol
OpenAI API Key
Active Models in CursorConnected & Ready
dola-seed-2.1-turboDefault Chat & Agent
dola-seed-2.0-miniFast Infill / Tab Auto-Complete
glm-5.2Complex Reasoning

4. API Endpoints Reference

POST/v1/chat/completions

Text completions & LLM reasoning using `dola-seed-2.1-turbo`, `dola-seed-2.0-mini`, `dola-seed-2.0-lite`, `glm-5.2`. Supports `stream: true` for Server-Sent Events.

POST/v1/images/generationsSeedream

High-definition AI image generation from text prompt or reference images (Image-to-Image / Style Transfer) using `seedream-5.0-lite` or `seedream-4.5`. Supports URLs or Base64.

POST/v1/videos/generationsSeedance

Short AI video generation with automated audio matching for TikTok (Model: `seedance-2.0-mini`, `seedance-1.5-pro`). Supports Text-to-Video, Image-to-Video (First & Last Frame), and Video-to-Video (Motion Transfer).

POST/api/v1/videos/enhancementsByteDance AI
Auth: Bearer API Key

Upscale and enhance video quality with AI Super-Resolution (de-noising, facial restoration, studio detail reconstruction) to 720p HD or 1080p Full HD. Use your standard APIDY API Key directly via server scripts, curl, or through the Apidy MCP Server.

720p HD Enhancement$0.000333 / s

~$0.020 per 60 seconds of video.

1080p Full HD Enhancement$0.000833 / s

~$0.050 per 60 seconds of video.

API Request Example (cURL):
# 1. Gửi video qua JSON link:
curl -X POST https://apidy.org/api/v1/videos/enhancements \
  -H "Authorization: Bearer sk-bp-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"video_url": "https://media.apidy.org/sample.mp4", "resolution": "1080p"}'

# 2. Hoặc upload trực tiếp file video:
curl -X POST https://apidy.org/api/v1/videos/enhancements \
  -H "Authorization: Bearer sk-bp-your-api-key" \
  -F "file=@/path/to/video.mp4" \
  -F "resolution=1080p"

# 3. Kiểm tra tiến độ & nhận link kết quả:
curl https://apidy.org/api/v1/videos/enhancements/{task_id} \
  -H "Authorization: Bearer sk-bp-your-api-key"
POST/api/studio/uploadStorage R2

Upload local image or video files to Cloudflare R2 storage to obtain permanent public URLs for image and video generation APIs.

5. Media Reference & Upload Guide (I2I, I2V, V2V)

APIDY AI Gateway fully supports advanced multimodal generation techniques: Image-to-Image, Image-to-Video (First Frame & Last Frame), Video-to-Video (Motion Reference), and direct Cloudflare R2 file upload API.

1. Direct HTTPS URL

Recommended. Pass direct public image/video URLs from any CDN, S3, R2, or storage bucket.

2. Base64 Data URI

Embed `data:image/png;base64,...` string directly in payload. The gateway mirrors it to R2 automatically.

3. APIDY Upload API

Use `POST /api/studio/upload` to upload local files and receive a permanent public URL.

How Seedance Image-to-Video Works

Provide a static initial image (First Frame). The AI preserves the character/product identity and animates smooth motion with context-matched ambient audio.

FieldTypeRequired?Description
first_frame_imagestringRecommendedStarting image URL or Base64 data URI. Aliases: `image_url`, `reference_image_url`.
last_frame_imagestringOptionalEnding image URL. Creates a morphing transition from first frame to last frame.
promptstringRequiredDescribes movement, camera motion, and desired atmospheric audio.
durationnumberOptionalVideo duration: 4 to 16 seconds (default: 5s).
generate_audiobooleanOptionalDefaults to `true`. AI automatically synthesizes sound effects & ambient music.
Code Example: Image-to-Video
curl https://apidy.org/api/v1/videos/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-bp-your-api-key" \
  -d '{
    "model": "seedance-1.5-pro",
    "prompt": "Sản phẩm xoay 360 độ từ từ, hiệu ứng ánh sáng neon chuyển động huyền ảo",
    "first_frame_image": "https://media.apidy.org/faces/sample-first-frame.jpg",
    "duration": 5,
    "resolution": "720p",
    "ratio": "16:9",
    "generate_audio": true
  }'
Important Safety & Content Guidelines
  • Avoid close-up real human faces: ByteDance content filters will block input media containing recognizable real human faces to prevent deepfakes. Use 3D models, AI digital avatars, or merchandise mockups instead.
  • Optimal resolution for reference media: For motion transfer tasks (V2V), setting `resolution: "720p"` guarantees maximum rendering speed and frame consistency.
  • Automatic Base64 handling: When passing data URIs (`data:image/...` or `data:video/...`), the gateway automatically mirrors them to Cloudflare R2 before forwarding to BytePlus.

6. Available Models & Pricing

Public Model IDProviderCategoryAPIDY Retail Price
dola-seed-2.1-turboPopularByteDanceLLM Text$0.6500 / per 1M tokens
dola-seed-2.0-miniFast & CheapByteDanceLLM Text$0.1966 / per 5s video 720p
dola-seed-2.0-liteCost-EffectiveByteDanceLLM Text$0.3250 / per 1M tokens
glm-5.2Verified LiveZ.AILLM Text$1.8200 / per 1M tokens
seedream-5.0-liteNewByteDanceAI Image$0.0455 / per image
seedream-4.5HD QualityByteDanceAI Image$0.0520 / per image
seedream-5.0-pro2K CinematicByteDanceAI Image$0.0780 / per 2K image
seed-2.0-codeBest for CodeByteDanceLLM Text$0.6500 / per 1M tokens
deepseek-v3.2128K ContextDeepSeekLLM Text$0.1820 / per 1M tokens
deepseek-v4-flashFlash ReasoningDeepSeekLLM Text$0.0910 / per 1M tokens
seedance-1.5-proDeprecatedByteDanceAI Video$0.3370 / per 5s video 720p
seedance-2.0-fastUltra Fast 2.0ByteDanceAI Video$0.5946 / per 5s video 720p
seedance-2.0-miniNext-Gen 2.0ByteDanceAI Video$0.1966 / per 5s video 720p
seedance-2.5Flagship 2.5ByteDanceAI Video$1.5023 / per 5s video 720p
video-enhancer720p / 1080pByteDanceAI Video$0.000333 (720p) - $0.000833 (1080p) / sec