Documentation

Welcome to the EMMA18 API documentation. EMMA18 provides a unified interface for accessing 300+ AI models from various providers through a single, OpenAI-compatible API.

Tip: EMMA18 is fully compatible with the OpenAI API. You can switch to EMMA18 by just changing the base URL and API key.

Quick Start

Get up and running with EMMA18 in under 5 minutes.

Integration Essentials

  • Base URL: https://YOUR_PLATFORM_HOST/api/v1
  • Auth header: Authorization: Bearer sk-your_api_key
  • Chat endpoint: POST /api/v1/chat/completions

1. Get Your API Key

Sign up for a free account and get your API key from the dashboard.

2. Install the SDK

EMMA18 works with the OpenAI SDK. Install it using pip:

pip install openai

3. Make Your First Request

import openai

client = openai.OpenAI(
    api_key="sk-your_api_key",
    base_url="https://YOUR_PLATFORM_HOST/api/v1"
)

response = client.chat.completions.create(
    model="deepseek/deepseek-chat",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
Seedance note: Seedance is a video async task API. Use POST /api/v1/video/seedance/tasks plus task polling, not /api/v1/chat/completions.

Common Error Hints

  • 401 - Invalid or missing API key.
  • 402 - Insufficient credits. Top up in Keys & Balance.
  • 403 - Model exists but your account/provider token has no permission.

Authentication

EMMA18 uses API keys for authentication. Include your key in the Authorization header.

Authorization: Bearer sk-your_api_key
Warning: Keep your API key secret! Do not share it in client-side code or public repositories.

Available Model Names

Use these IDs in the model field. Pull the latest list before production traffic.

Chat model IDs (practical set)

deepseek/deepseek-chat
moonshotai/kimi-k2
moonshotai/kimi-k2.6
MiniMax-M2.7
GLM5.1
anthropic/claude-sonnet-4.6

Seedance task model IDs (video)

dreamina-seedance-2-0-260128
dreamina-seedance-2-0-fast-260128

Fetch the current model list via API

Discover your account-specific chat models from the models endpoint.

GET /api/v1/models
curl https://YOUR_PLATFORM_HOST/api/v1/models \
  -H "Authorization: Bearer sk-your_api_key"
Important: Model availability can vary by account credits and upstream provider permissions. Always handle 403/429/5xx fallback.

Agent / MCP

MCP (Model Context Protocol) is a standard that lets AI agents securely call external tools and data sources with clear permissions.

When should you read MCP docs vs REST API docs?

  • If your app only sends requests to chat/models endpoints, REST API docs are enough.
  • If you want agents to operate tools (tickets, databases, internal systems), you need MCP-focused docs.
Current recommendation: If there is no officially published public MCP server yet, start with REST API first.

Minimal executable path

  1. Get API key from Keys & Balance.
  2. Call POST /api/v1/chat/completions with Base URL https://YOUR_PLATFORM_HOST/api/v1.
  3. Add MCP integration later only when a public MCP endpoint and auth method are officially documented.

Chat Completions

Create chat-based completions using the /api/v1/chat/completions endpoint.

POST /api/v1/chat/completions

Request Parameters

Parameter Type Required Description
model string required Model ID from GET /api/v1/models (e.g., deepseek/deepseek-chat)
messages array required Array of message objects with role and content
temperature number optional Sampling temperature (0-2)
max_tokens integer optional Maximum tokens to generate
stream boolean optional Enable streaming responses

Example Request

{
  "model": "deepseek/deepseek-chat",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "What is the capital of France?"}
  ],
  "temperature": 0.7,
  "max_tokens": 150
}

Seedance 2.0 (Video)

Seedance 2.0 is EMMA18's async video generation API (ByteDance / Dreamina). It is not OpenAI chat/completions — create a task, then poll until a terminal status.

Async task pattern: Submit with POST /api/v1/video/seedance/tasks, then poll GET /api/v1/video/seedance/tasks/{task_id} until succeeded / failed / expired / cancelled.

What you get

  • Text-to-video, image-to-video, and video-to-video (t2v / i2v / v2v)
  • Listed on GET /api/v1/models with capabilities.api_pattern = async_task
  • USD / K-token matrix pricing (video reference × resolution) — view it in the Models hover card or the pricing section in these docs.

Authentication

Same platform API key as chat. Send it on every Seedance request:

Authorization: Bearer sk-your_api_key
Idempotency-Key: seedance-<unique-id>   # required on create

Model IDs

Use these IDs in the model field (or omit to use the gateway default):

dreamina-seedance-2-0-260128

Discover the live list with GET /api/v1/video/seedance/models or GET /api/v1/models (filter ids containing seedance).

Modes

GET /api/v1/video/seedance/modes

Returns mode list, required fields, and Seedance 2.0 model list.

  • t2vtext-to-video from prompt only.
  • i2vimage-to-video from prompt + reference image(s).
  • v2vvideo-to-video from prompt + reference video(s), with optional image/audio references.

1. Create a task

POST /api/v1/video/seedance/tasks

Requires header Idempotency-Key. Reusing the same key with the same payload returns the original task; a different payload returns 409 idempotency_conflict.

Request parameters

Parameter Type Required Description
mode string required* t2v | i2v | v2v | first_frame | first_last | omni (*or pass raw content[] without mode)
prompt string required Text prompt when using mode contracts
model string optional Defaults to dreamina-seedance-2-0-260128
image_url / image_urls string / array i2v/v2v Reference image(s) for i2v (required) or optional v2v
video_url / video_urls string / array v2v Reference video(s) for v2v (required)
audio_urls array optional Optional reference audio for v2v
duration integer optional Target length in seconds (e.g. 4)
resolution string optional e.g. 480p, 720p, 1080p
ratio string optional Aspect ratio, e.g. 16:9, 9:16, 1:1
generate_audio boolean optional Whether to generate audio track
camera_fixed boolean optional Keep camera fixed when supported
watermark boolean optional Include watermark when supported

t2v example (4s)

curl https://YOUR_PLATFORM_HOST/api/v1/video/seedance/tasks \
  -H "Authorization: Bearer sk-your_api_key" \
  -H "Idempotency-Key: seedance-t2v-001" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "t2v",
    "prompt": "A cinematic sunrise over calm ocean waves, soft golden light",
    "model": "dreamina-seedance-2-0-260128",
    "duration": 4,
    "resolution": "480p",
    "ratio": "9:16",
    "generate_audio": false,
    "watermark": false
  }'

Successful create returns an upstream task id:

{ "id": "cgt-xxxxxxxx" }

i2v example

curl https://YOUR_PLATFORM_HOST/api/v1/video/seedance/tasks \
  -H "Authorization: Bearer sk-your_api_key" \
  -H "Idempotency-Key: seedance-i2v-001" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "i2v",
    "prompt": "The subject turns and smiles at camera with soft lighting",
    "image_url": "https://example.com/reference-image.jpg",
    "model": "dreamina-seedance-2-0-260128",
    "duration": 4,
    "resolution": "720p",
    "ratio": "16:9"
  }'

v2v example

curl https://YOUR_PLATFORM_HOST/api/v1/video/seedance/tasks \
  -H "Authorization: Bearer sk-your_api_key" \
  -H "Idempotency-Key: seedance-v2v-001" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "v2v",
    "prompt": "Keep camera movement from the reference video, add neon cyberpunk style",
    "video_url": "https://example.com/reference-video.mp4",
    "model": "dreamina-seedance-2-0-260128",
    "duration": 4
  }'

2. Poll task status

GET /api/v1/video/seedance/tasks/{task_id}

Or POST body poll:

POST /api/v1/video/seedance/tasks/status
curl https://YOUR_PLATFORM_HOST/api/v1/video/seedance/tasks/cgt-xxxxxxxx \
  -H "Authorization: Bearer sk-your_api_key"

Status values

  • running / queued — keep polling (e.g. every 5–10s)
  • succeeded — video ready; read content.video_url
  • failed / expired / cancelled — terminal error

Succeeded response (shape)

{
  "id": "cgt-xxxxxxxx",
  "model": "dreamina-seedance-2-0-260128",
  "status": "succeeded",
  "duration": 4,
  "resolution": "480p",
  "ratio": "9:16",
  "content": { "video_url": "https://.../video.mp4?..." },
  "usage": { "completion_tokens": 40594, "total_tokens": 40594 },
  "gateway": {
    "task_id": "cgt-xxxxxxxx",
    "billing_status": "charged",
    "billed_cost": 0.287
  }
}

Pricing & billing

Customer rates per 1K tokens (shown in your selected currency), billed on total_tokens when the task succeeds:

480p/720p 1080p 4K
Input without video $0.0088 / K $0.0096 / K $0.0050 / K
Input with video $0.0054 / K $0.0059 / K $0.0030 / K
  • Account is billed in USD credits per 1K tokens (matrix by video-reference input × resolution). The table above converts for display only.
  • Live rates: GET /api/v1/video/seedance/pricing, the Models hover card, and the Playground.
  • Charged once when status becomes succeeded (gateway.billing_status)

Error codes

HTTP code Meaning
400 Missing Idempotency-Key, unsupported mode, or invalid mode fields
402 Insufficient credits
404 seedance_task_not_found / upstream Unknown task id, or upstream model not found / not activated
409 idempotency_conflict Same Idempotency-Key used with a different payload
503 seedance_not_configured Seedance disabled or API key missing on gateway
504 / 5xx seedance_timeout / seedance_upstream_error Upstream timeout or provider error

Endpoint summary

  • GET /api/v1/models — includes Seedance when enabled
  • GET /api/v1/video/seedance/models
  • GET /api/v1/video/seedance/modes
  • GET /api/v1/video/seedance/pricing
  • POST /api/v1/video/seedance/tasks
  • GET /api/v1/video/seedance/tasks/{task_id}
  • POST /api/v1/video/seedance/tasks/status

Models

List account-visible chat models and their capabilities.

GET /api/v1/models

Response

{
  "data": [
    {
      "id": "deepseek/deepseek-chat",
      "name": "DeepSeek Chat",
      "description": "General-purpose chat model",
      "context_length": 128000,
      "pricing": {
        "prompt": "0.00000015",
        "completion": "0.0000006"
      }
    }
  ]
}

Providers and models

Provider availability is reflected in the live model catalog. Open Models.

Account, API keys, and top-up

Manage credentials and balance from your account, then use the canonical Top-up page for available payment methods and packages. Account / API Keys · Top-up

Code Examples

Python

import openai

client = openai.OpenAI(
    api_key="sk-your_api_key",
    base_url="https://YOUR_PLATFORM_HOST/api/v1"
)

# Chat completion
response = client.chat.completions.create(
    model="deepseek/deepseek-chat",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

JavaScript / Node.js

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-your_api_key',
  baseURL: 'https://YOUR_PLATFORM_HOST/api/v1'
});

const response = await client.chat.completions.create({
  model: 'deepseek/deepseek-chat',
  messages: [{role: 'user', content: 'Hello!'}]
});
console.log(response.choices[0].message.content);

cURL

curl https://YOUR_PLATFORM_HOST/api/v1/chat/completions \
  -H "Authorization: Bearer sk-your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-chat",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Go

client := openai.NewClient(
    openai.WithAPIKey("sk-your_api_key"),
    openai.WithBaseURL("https://YOUR_PLATFORM_HOST/api/v1"),
)

resp, err := client.Chat.Completions.New(context.Background(),
    openai.ChatCompletionNewParams{
        Model: "deepseek/deepseek-chat",
        Messages: []openai.ChatCompletionNewParamsMessages{
            {Role: openai.ChatCompletionNewParamsMessagesRoleUser, Content: "Hello!"},
        },
    },
)

Error Handling

EMMA18 uses standard HTTP status codes for errors. Error responses include a JSON body with a detail field describing the issue.

Status Code Description
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
402 Insufficient Credits - Add more credits to your account
403 Forbidden - Model/provider permission denied for this account
404 Not Found - Model or resource doesn't exist
429 Rate Limited - Too many requests
500 Internal Server Error - Something went wrong on our end
Note: If you encounter persistent errors, check our status page or contact support.