each-sense

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

each::sense - Intelligent Layer for Generative Media

each::sense - 生成式媒体的智能层

each::sense is an OpenAI-compatible AI agent that can generate images, videos, audio, 3D models, build workflows, search the web, and hold conversational interactions. It orchestrates 500+ AI models through a single unified interface.
each::sense itself is completely free. You only get charged for the models it uses.
Use each::sense when the user needs:
  • Marketing assets and ad creatives
  • Product images and e-commerce visuals
  • Video content (ads, UGC, social media)
  • Audio and music generation
  • Any creative content generation
  • Multi-step workflows combining multiple AI models
each::sense 是一款兼容OpenAI的AI Agent,可生成图像、视频、音频、3D模型,构建工作流、进行网页搜索并支持对话交互。它通过单一统一界面协调500余种AI模型。
each::sense 本身完全免费,仅在使用其调用的模型时产生费用。
以下场景可使用each::sense:
  • 营销素材与广告创意
  • 产品图片与电商视觉内容
  • 视频内容(广告、UGC、社交媒体内容)
  • 音频与音乐生成
  • 任何创意内容生成
  • 结合多AI模型的多步骤工作流

Authentication

身份验证

Header: X-API-Key: <your-api-key>
Also supports OpenAI SDK compatible authentication:
Header: Authorization: Bearer <your-api-key>
Get your API key at eachlabs.ai.
Set the
EACHLABS_API_KEY
environment variable.
Header: X-API-Key: <your-api-key>
同时支持兼容OpenAI SDK的身份验证方式:
Header: Authorization: Bearer <your-api-key>
可前往 eachlabs.ai 获取你的API密钥。
设置环境变量
EACHLABS_API_KEY

Base URL

基础URL

https://eachsense-agent.core.eachlabs.run
https://eachsense-agent.core.eachlabs.run

Endpoints

端点

MethodPathPurpose
POST
/v1/chat/completions
Primary chat endpoint
POST
/workflow
Workflow builder
GET
/v1/models
List available models
GET
/memory?session_id={id}
Retrieve session memory
DELETE
/memory?session_id={id}
Clear session memory
GET
/sessions
List all sessions
请求方法路径用途
POST
/v1/chat/completions
主要对话端点
POST
/workflow
工作流构建器
GET
/v1/models
列出可用模型
GET
/memory?session_id={id}
获取会话记忆
DELETE
/memory?session_id={id}
清除会话记忆
GET
/sessions
列出所有会话

Quick Start

快速开始

Using curl

使用curl

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Generate a portrait of a woman with golden hour lighting"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Generate a portrait of a woman with golden hour lighting"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'

Using Python (OpenAI SDK)

使用Python(OpenAI SDK)

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_EACHLABS_API_KEY",
    base_url="https://eachsense-agent.core.eachlabs.run/v1"
)
python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_EACHLABS_API_KEY",
    base_url="https://eachsense-agent.core.eachlabs.run/v1"
)

Non-streaming

非流式响应

response = client.chat.completions.create( model="eachsense/beta", messages=[{"role": "user", "content": "Generate a sunset landscape"}], stream=False ) print(response.generations) # List of media URLs
response = client.chat.completions.create( model="eachsense/beta", messages=[{"role": "user", "content": "Generate a sunset landscape"}], stream=False ) print(response.generations) # 媒体URL列表

Streaming

流式响应

stream = client.chat.completions.create( model="eachsense/beta", messages=[{"role": "user", "content": "Generate a sunset landscape"}], stream=True ) for chunk in stream: eachlabs_data = chunk.model_extra.get("eachlabs") if eachlabs_data: event_type = eachlabs_data.get("type") if event_type == "generation_response": print(eachlabs_data["generations"])
undefined
stream = client.chat.completions.create( model="eachsense/beta", messages=[{"role": "user", "content": "Generate a sunset landscape"}], stream=True ) for chunk in stream: eachlabs_data = chunk.model_extra.get("eachlabs") if eachlabs_data: event_type = eachlabs_data.get("type") if event_type == "generation_response": print(eachlabs_data["generations"])
undefined

Using JavaScript (OpenAI SDK)

使用JavaScript(OpenAI SDK)

javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_EACHLABS_API_KEY",
  baseURL: "https://eachsense-agent.core.eachlabs.run/v1"
});

// Non-streaming
const response = await client.chat.completions.create({
  model: "eachsense/beta",
  messages: [{ role: "user", content: "Generate a sunset landscape" }],
  stream: false
});
console.log(response.generations);

// Streaming
const stream = await client.chat.completions.create({
  model: "eachsense/beta",
  messages: [{ role: "user", content: "Generate a sunset landscape" }],
  stream: true
});
for await (const chunk of stream) {
  const eachlabs = chunk.eachlabs;
  if (eachlabs?.type === "generation_response") {
    console.log(eachlabs.generations);
  }
}
javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_EACHLABS_API_KEY",
  baseURL: "https://eachsense-agent.core.eachlabs.run/v1"
});

// 非流式响应
const response = await client.chat.completions.create({
  model: "eachsense/beta",
  messages: [{ role: "user", content: "Generate a sunset landscape" }],
  stream: false
});
console.log(response.generations);

// 流式响应
const stream = await client.chat.completions.create({
  model: "eachsense/beta",
  messages: [{ role: "user", content: "Generate a sunset landscape" }],
  stream: true
});
for await (const chunk of stream) {
  const eachlabs = chunk.eachlabs;
  if (eachlabs?.type === "generation_response") {
    console.log(eachlabs.generations);
  }
}

Request Schema

请求 Schema

json
{
  "messages": [{"role": "user", "content": "string (required) - User's request"}],
  "model": "string (optional, default: 'eachsense/beta')",
  "stream": "boolean (optional, default: true) - Enable SSE streaming",
  "session_id": "string (optional) - Session ID for conversation history and multi-turn chats",
  "mode": "string (optional, default: 'max') - Quality mode: 'max' or 'eco'",
  "behavior": "string (optional, default: 'agent') - Behavior: 'agent', 'plan', or 'ask'",
  "image_urls": "array[string] (optional) - Image URLs for editing/processing (max 4)",
  "workflow_id": "string (optional) - Execute specific workflow",
  "version_id": "string (optional) - Workflow version",
  "web_search": "boolean (optional, default: true) - Enable/disable web search",
  "enable_safety_checker": "boolean (optional, default: true) - Set to false to allow NSFW content generation"
}
json
{
  "messages": [{"role": "user", "content": "string (required) - 用户请求"}],
  "model": "string (optional, default: 'eachsense/beta')",
  "stream": "boolean (optional, default: true) - 启用SSE流式传输",
  "session_id": "string (optional) - 用于对话历史和多轮对话的会话ID",
  "mode": "string (optional, default: 'max') - 质量模式:'max' 或 'eco'",
  "behavior": "string (optional, default: 'agent') - 行为模式:'agent', 'plan', 或 'ask'",
  "image_urls": "array[string] (optional) - 用于编辑/处理的图片URL(最多4个)",
  "workflow_id": "string (optional) - 执行特定工作流",
  "version_id": "string (optional) - 工作流版本",
  "web_search": "boolean (optional, default: true) - 启用/禁用网页搜索",
  "enable_safety_checker": "boolean (optional, default: true) - 设置为false以允许生成NSFW内容"
}

Parameter Details

参数详情

ParameterTypeDefaultDescription
messages
arrayrequiredChat messages with
role
and
content
model
string"eachsense/beta"Model identifier
stream
booleantrueEnable SSE streaming
session_id
stringnullSession ID for conversation history. Use to continue previous chats, handle clarifications, and iteratively refine outputs
mode
string"max"
max
= best quality (premium models),
eco
= fastest/cheapest
behavior
string"agent"
agent
= auto-execute,
plan
= show plan first,
ask
= clarify first
image_urls
arraynullURLs of images to process/edit (max 4)
workflow_id
stringnullExecute a specific workflow
version_id
stringnullWorkflow version, used with workflow_id
web_search
booleantrueAllow web search for information
enable_safety_checker
booleantrueSet to false to allow NSFW content generation
OpenAI SDK extra parameters: When using the OpenAI SDK, pass non-standard parameters via
extra_body
:
python
response = client.chat.completions.create(
    model="eachsense/beta",
    messages=[{"role": "user", "content": "Generate a quick sketch"}],
    extra_body={"mode": "eco", "session_id": "my-session"},
    stream=False
)
参数类型默认值说明
messages
数组必填包含
role
content
的对话消息
model
字符串"eachsense/beta"模型标识符
stream
布尔值true启用SSE流式传输
session_id
字符串null对话历史的会话ID,用于继续之前的对话、处理澄清请求及迭代优化输出
mode
字符串"max"
max
= 最佳质量(高级模型),
eco
= 最快/最经济
behavior
字符串"agent"
agent
= 自动执行,
plan
= 先展示执行计划,
ask
= 先请求澄清
image_urls
数组null待处理/编辑的图片URL(最多4个)
workflow_id
字符串null执行特定工作流
version_id
字符串null工作流版本,需与workflow_id配合使用
web_search
布尔值true是否允许通过网页搜索获取信息
enable_safety_checker
布尔值true设置为false以允许生成NSFW内容
OpenAI SDK额外参数: 使用OpenAI SDK时,通过
extra_body
传递非标准参数:
python
response = client.chat.completions.create(
    model="eachsense/beta",
    messages=[{"role": "user", "content": "Generate a quick sketch"}],
    extra_body={"mode": "eco", "session_id": "my-session"},
    stream=False
)

Non-Streaming Response

非流式响应

json
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "choices": [{"message": {"role": "assistant", "content": "Here's your image..."}}],
  "generations": ["https://cdn.example.com/image.png"],
  "task_id": "task-456",
  "session_id": "my-session"
}
json
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "choices": [{"message": {"role": "assistant", "content": "Here's your image..."}}],
  "generations": ["https://cdn.example.com/image.png"],
  "task_id": "task-456",
  "session_id": "my-session"
}

Modes

模式

MAX Mode (Default)

MAX模式(默认)

Uses premium quality models (flux-2-max, veo-3, etc.). Best for final outputs, client-facing work, and when quality matters most. Processing time: 10-300 seconds.
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a product shot"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'
使用高质量模型(flux-2-max、veo-3等),最适合最终输出、面向客户的工作及对质量要求极高的场景。处理时间:10-300秒。
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a product shot"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'

ECO Mode

ECO模式

Uses fast, cost-effective models (flux-2-pro, veo3-1-fast, etc.). Best for prototyping, drafts, and high-volume generation. Processing time: 5-180 seconds.
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a product shot"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "eco"
  }'
使用快速、经济的模型(flux-2-pro、veo3-1-fast等),最适合原型制作、草稿生成及大批量内容生成。处理时间:5-180秒。
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a product shot"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "eco"
  }'

Behaviors

行为模式

Agent (Default)

Agent(默认)

Automatically executes the request, selecting the best model and generating output immediately.
json
{
  "messages": [{"role": "user", "content": "Generate a sunset video"}],
  "model": "eachsense/beta",
  "behavior": "agent"
}
自动执行请求,选择最优模型并立即生成输出。
json
{
  "messages": [{"role": "user", "content": "Generate a sunset video"}],
  "model": "eachsense/beta",
  "behavior": "agent"
}

Plan

Plan

Shows execution plan with time/cost estimates before executing. Good for complex requests where you want to review the approach.
json
{
  "messages": [{"role": "user", "content": "Create a marketing video for my bakery"}],
  "model": "eachsense/beta",
  "behavior": "plan"
}
执行前先展示包含时间/成本估算的执行计划,适合需要审核方案的复杂请求。
json
{
  "messages": [{"role": "user", "content": "Create a marketing video for my bakery"}],
  "model": "eachsense/beta",
  "behavior": "plan"
}

Ask

Ask

Always asks clarifying questions before proceeding. Good when you want maximum control.
json
{
  "messages": [{"role": "user", "content": "Generate a portrait"}],
  "model": "eachsense/beta",
  "behavior": "ask"
}
执行前始终请求澄清信息,适合需要最大控制权的场景。
json
{
  "messages": [{"role": "user", "content": "Generate a portrait"}],
  "model": "eachsense/beta",
  "behavior": "ask"
}

Session Management

会话管理

Use
session_id
to maintain conversation history and context across multiple requests. This enables:
  • Multi-turn conversations: Follow-up on previous requests without repeating context
  • Iterative refinement: Ask for modifications to previously generated content
  • Clarification flows: Respond to
    clarification_needed
    events and continue the conversation
  • Context awareness: The AI remembers previous generations, preferences, and instructions
使用
session_id
在多次请求间维护对话历史和上下文,支持:
  • 多轮对话:无需重复上下文即可跟进之前的请求
  • 迭代优化:请求修改之前生成的内容
  • 澄清流程:响应
    clarification_needed
    事件并继续对话
  • 上下文感知:AI会记住之前的生成内容、偏好和指令

Session Limits

会话限制

MetricLimit
Idle timeout15 minutes
Session TTL30 days
Messages per session50
Sessions are scoped by API key + session_id combination. Different API keys cannot access each other's sessions.
指标限制
空闲超时15分钟
会话有效期30天
单会话消息数50条
会话范围由API密钥+session_id组合确定,不同API密钥无法访问彼此的会话。

Session Management Endpoints

会话管理端点

bash
undefined
bash
undefined

Retrieve session memory

获取会话记忆

Clear session memory

清除会话记忆

curl -X DELETE https://eachsense-agent.core.eachlabs.run/memory?session_id=my-session
-H "X-API-Key: $EACHLABS_API_KEY"
curl -X DELETE https://eachsense-agent.core.eachlabs.run/memory?session_id=my-session
-H "X-API-Key: $EACHLABS_API_KEY"

List all sessions

列出所有会话

curl https://eachsense-agent.core.eachlabs.run/sessions
-H "X-API-Key: $EACHLABS_API_KEY"
undefined
curl https://eachsense-agent.core.eachlabs.run/sessions
-H "X-API-Key: $EACHLABS_API_KEY"
undefined

Example: Iterative Generation

示例:迭代生成

bash
undefined
bash
undefined

First request - generate initial image

首次请求 - 生成初始图片

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Generate a logo for a coffee shop called Brew Lab"}], "model": "eachsense/beta", "stream": true, "session_id": "logo-project-001" }'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Generate a logo for a coffee shop called Brew Lab"}], "model": "eachsense/beta", "stream": true, "session_id": "logo-project-001" }'

Follow-up - modify the result (same session_id)

后续请求 - 修改结果(使用相同session_id)

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Make it more minimalist and change the color to dark green"}], "model": "eachsense/beta", "stream": true, "session_id": "logo-project-001" }'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Make it more minimalist and change the color to dark green"}], "model": "eachsense/beta", "stream": true, "session_id": "logo-project-001" }'

Another follow-up - request variation (same session_id)

再次后续请求 - 生成变体(使用相同session_id)

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Create 3 variations of this logo"}], "model": "eachsense/beta", "stream": true, "session_id": "logo-project-001" }'
undefined
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Create 3 variations of this logo"}], "model": "eachsense/beta", "stream": true, "session_id": "logo-project-001" }'
undefined

Example: Handling Clarifications

示例:处理澄清请求

bash
undefined
bash
undefined

Ambiguous request - AI will ask for clarification

模糊请求 - AI会请求澄清

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Edit this image"}], "model": "eachsense/beta", "stream": true, "session_id": "edit-task-001", "image_urls": ["https://example.com/photo.jpg"] }'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Edit this image"}], "model": "eachsense/beta", "stream": true, "session_id": "edit-task-001", "image_urls": ["https://example.com/photo.jpg"] }'

Response: clarification_needed event asking what edit to make

响应:clarification_needed事件,询问具体编辑需求

Respond to clarification (same session_id)

响应澄清请求(使用相同session_id)

curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Remove the background and make it transparent"}], "model": "eachsense/beta", "stream": true, "session_id": "edit-task-001", "image_urls": ["https://example.com/photo.jpg"] }'
undefined
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Remove the background and make it transparent"}], "model": "eachsense/beta", "stream": true, "session_id": "edit-task-001", "image_urls": ["https://example.com/photo.jpg"] }'
undefined

Use Case Examples

用例示例

1. Image Generation

1. 图像生成

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Generate a professional headshot of a business executive, studio lighting"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Generate a professional headshot of a business executive, studio lighting"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'

2. Video Generation

2. 视频生成

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a 5 second video of a sunset over the ocean"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a 5 second video of a sunset over the ocean"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'

3. Image Editing (with uploaded image)

3. 图像编辑(使用上传图片)

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Remove the background from this image"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/my-photo.jpg"]
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Remove the background from this image"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/my-photo.jpg"]
  }'

4. Image-to-Video Animation

4. 图像转视频动画

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Animate this image with gentle camera movement"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/landscape.jpg"]
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Animate this image with gentle camera movement"}],
    "model": "eachsense/beta",
    "stream": true,
    "image_urls": ["https://example.com/landscape.jpg"]
  }'

5. Product Photography

5. 产品摄影

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Generate a product shot of a coffee mug on a wooden table with morning light"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Generate a product shot of a coffee mug on a wooden table with morning light"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'

6. Marketing Assets

6. 营销素材

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a social media ad for a fitness app, show someone working out with energetic vibes"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a social media ad for a fitness app, show someone working out with energetic vibes"}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'

7. Complex Workflow (UGC Video)

7. 复杂工作流(UGC视频)

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a 30 second UGC video with a consistent presenter explaining why fitness is important. The presenter is a 30-year-old fit woman with brown hair in workout clothes, gym background."}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -H "Accept: text/event-stream" \
  -d '{
    "messages": [{"role": "user", "content": "Create a 30 second UGC video with a consistent presenter explaining why fitness is important. The presenter is a 30-year-old fit woman with brown hair in workout clothes, gym background."}],
    "model": "eachsense/beta",
    "stream": true,
    "mode": "max"
  }'

8. Workflow Builder

8. 工作流构建器

bash
curl -X POST https://eachsense-agent.core.eachlabs.run/workflow \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -d '{
    "message": "Create a workflow that generates an image and then upscales it",
    "stream": true,
    "session_id": "my-session"
  }'
bash
curl -X POST https://eachsense-agent.core.eachlabs.run/workflow \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $EACHLABS_API_KEY" \
  -d '{
    "message": "Create a workflow that generates an image and then upscales it",
    "stream": true,
    "session_id": "my-session"
  }'

SSE Response Format

SSE响应格式

The endpoint returns Server-Sent Events (SSE) wrapped in OpenAI
chat.completion.chunk
format with an
eachlabs
extension field.
Each event has the format:
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","choices":[{"delta":{"content":""}}],"eachlabs":{"type":"event_type",...}}\n\n
Stream ends with:
data: [DONE]\n\n
端点返回封装在OpenAI
chat.completion.chunk
格式中的Server-Sent Events(SSE),带有
eachlabs
扩展字段。
每个事件格式如下:
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","choices":[{"delta":{"content":""}}],"eachlabs":{"type":"event_type",...}}\n\n
流结束时返回:
data: [DONE]\n\n

Event Types (18 Total)

事件类型(共18种)

AI Reasoning:
EventDescription
thinking_delta
AI reasoning in real-time
text_response
Text content (explanations, answers)
Tool Operations:
EventDescription
status
Current operation being executed (includes
tool_name
,
parameters
)
tool_call
Details of tool being called
message
Informational message
progress
Progress update with
percent
Generation:
EventDescription
generation_response
Generated media URL (
url
,
generations[]
,
model
,
execution_time_ms
)
Interaction:
EventDescription
clarification_needed
AI needs more information (
question
,
options[]
,
context
)
Web Search:
EventDescription
web_search_query
Web search being executed
web_search_citations
Citations with
title
,
url
,
snippet
Workflow:
EventDescription
workflow_created
New workflow created
workflow_fetched
Existing workflow loaded
workflow_built
Workflow definition constructed
workflow_updated
Workflow pushed to API
Execution:
EventDescription
execution_started
Workflow execution began
execution_progress
Step progress (
step_id
,
completed_steps
,
total_steps
)
execution_completed
Workflow done (
output
,
all_outputs
,
total_time_ms
)
Terminal:
EventDescription
complete
Task finished (
status
: ok/error/clarification_needed,
generations[]
)
error
Error occurred (
message
,
error_code
)
AI推理:
事件说明
thinking_delta
AI实时推理过程
text_response
文本内容(解释、回答)
工具操作:
事件说明
status
当前正在执行的操作(包含
tool_name
parameters
tool_call
调用工具的详细信息
message
信息提示
progress
进度更新,包含
percent
生成操作:
事件说明
generation_response
生成的媒体URL(
url
,
generations[]
,
model
,
execution_time_ms
交互操作:
事件说明
clarification_needed
AI需要更多信息(
question
,
options[]
,
context
网页搜索:
事件说明
web_search_query
正在执行的网页搜索
web_search_citations
引用信息,包含
title
,
url
,
snippet
工作流:
事件说明
workflow_created
已创建新工作流
workflow_fetched
已加载现有工作流
workflow_built
已构建工作流定义
workflow_updated
已推送工作流至API
执行操作:
事件说明
execution_started
工作流已开始执行
execution_progress
步骤进度(
step_id
,
completed_steps
,
total_steps
execution_completed
工作流已完成(
output
,
all_outputs
,
total_time_ms
终端事件:
事件说明
complete
任务已完成(
status
: ok/error/clarification_needed,
generations[]
error
发生错误(
message
,
error_code

Typical Event Flow

典型事件流程

thinking_delta → status → status → text_response → generation_response → complete → [DONE]
thinking_delta → status → status → text_response → generation_response → complete → [DONE]

Key Event Examples

关键事件示例

generation_response

generation_response

json
{
  "type": "generation_response",
  "url": "https://storage.eachlabs.ai/outputs/abc123.png",
  "generations": ["https://storage.eachlabs.ai/outputs/abc123.png"],
  "model": "flux-2-max",
  "execution_time_ms": 8500
}
json
{
  "type": "generation_response",
  "url": "https://storage.eachlabs.ai/outputs/abc123.png",
  "generations": ["https://storage.eachlabs.ai/outputs/abc123.png"],
  "model": "flux-2-max",
  "execution_time_ms": 8500
}

clarification_needed

clarification_needed

json
{
  "type": "clarification_needed",
  "question": "What type of edit would you like to make to this image?",
  "options": ["Remove the background", "Apply a style transfer", "Upscale to higher resolution"],
  "context": "I can see your image but need to know the specific edit you want."
}
json
{
  "type": "clarification_needed",
  "question": "What type of edit would you like to make to this image?",
  "options": ["Remove the background", "Apply a style transfer", "Upscale to higher resolution"],
  "context": "I can see your image but need to know the specific edit you want."
}

complete

complete

json
{
  "type": "complete",
  "task_id": "chat_1708345678901",
  "status": "ok",
  "generations": ["https://storage.eachlabs.ai/outputs/abc123.png"],
  "model": "flux-2-max"
}
json
{
  "type": "complete",
  "task_id": "chat_1708345678901",
  "status": "ok",
  "generations": ["https://storage.eachlabs.ai/outputs/abc123.png"],
  "model": "flux-2-max"
}

Agent Tools

Agent工具

ToolTypePurpose
search_models
Non-terminalFind models by use case
get_model_details
Non-terminalGet model input schema
web_search
Non-terminalWeb search
vision_preprocessor
Non-terminalAnalyze image content
execute_model
TerminalRun model prediction
generate_text
TerminalGenerate text response
create_workflow
Non-terminalCreate workflow
trigger_workflow
Non-terminalExecute workflow
build_workflow
Non-terminalBuild workflow definition
check_execution
Non-terminalCheck execution status
ask_clarification
TerminalRequest clarification
工具类型用途
search_models
非终端根据使用场景查找模型
get_model_details
非终端获取模型输入Schema
web_search
非终端网页搜索
vision_preprocessor
非终端分析图像内容
execute_model
终端运行模型预测
generate_text
终端生成文本响应
create_workflow
非终端创建工作流
trigger_workflow
非终端执行工作流
build_workflow
非终端构建工作流定义
check_execution
非终端检查执行状态
ask_clarification
终端请求澄清信息

Model Quick Reference

模型快速参考

Use CaseModel SlugSpeed
Best image quality
flux-2-max
Medium
Fast image generation
flux-2-pro
Fast
Text/logos in images
flux-kontext-pro
Fast
Rapid prototyping
nano-banana-pro
Very Fast
Photorealistic images
gemini-imagen-4
Medium
Artistic/creative
seedream-v4-5
Medium
Best video (with audio)
veo-3
Slow
Fast video
veo3-1-fast
Fast
High-quality video
kling-3-0
Medium
Image to video
kling-2-1-image-to-video
Medium
Instruction editing
flux-2-edit
Fast
Background removal
eachlabs-bg-remover-v1
Very Fast
Image upscaling
topaz-upscale-image
Fast
Face swap
kling-face-swap
Fast
Text-to-speech
elevenlabs-tts
Very Fast
Music generation
mureka-generate-music
Medium
使用场景模型标识速度
最佳图像质量
flux-2-max
中等
快速图像生成
flux-2-pro
快速
图像中生成文字/Logo
flux-kontext-pro
快速
快速原型制作
nano-banana-pro
极快
写实风格图像
gemini-imagen-4
中等
艺术/创意风格
seedream-v4-5
中等
最佳视频(含音频)
veo-3
慢速
快速视频生成
veo3-1-fast
快速
高质量视频
kling-3-0
中等
图像转视频
kling-2-1-image-to-video
中等
指令式编辑
flux-2-edit
快速
背景移除
eachlabs-bg-remover-v1
极快
图像放大
topaz-upscale-image
快速
人脸替换
kling-face-swap
快速
文本转语音
elevenlabs-tts
极快
音乐生成
mureka-generate-music
中等

Model Aliases

模型别名

Common shorthand names that are automatically resolved:
AliasResolves To
Flux Maxflux-2-max
Flux Proflux-2-pro
Flux Editflux-2-edit
Flux Fillflux-fill-pro
Flux Kontextflux-kontext-pro
Imagen 4gemini-imagen-4
Veo 3veo-3
Kling 3kling-3-0
Sorasora-2-pro
ElevenLabselevenlabs-tts
自动解析的常用简写名称:
别名解析为
Flux Maxflux-2-max
Flux Proflux-2-pro
Flux Editflux-2-edit
Flux Fillflux-fill-pro
Flux Kontextflux-kontext-pro
Imagen 4gemini-imagen-4
Veo 3veo-3
Kling 3kling-3-0
Sorasora-2-pro
ElevenLabselevenlabs-tts

Error Handling

错误处理

HTTP Errors

HTTP错误

CodeResponseCause
401
{"error": "Invalid or missing API key"}
Missing or invalid API key
422
{"error": "..."}
Missing required fields or invalid parameters
429
{"error": "..."}
Rate limited - implement exponential backoff
500
{"error": "..."}
Internal server error - retry with backoff
状态码响应内容原因
401
{"error": "Invalid or missing API key"}
API密钥缺失或无效
422
{"error": "..."}
缺少必填字段或参数无效
429
{"error": "..."}
请求超限 - 实现指数退避重试
500
{"error": "..."}
服务器内部错误 - 退避后重试

Streaming Errors

流式错误

json
{"type": "error", "message": "Failed to execute model: Invalid parameters", "error_code": "..."}
Error MessageCauseSolution
Model execution failed
Underlying model errorCheck model parameters
Session not found
Invalid or expired sessionCreate new session
Workflow execution timeout
Exceeded 15 minute limitSplit into smaller workflows
Retry strategy: Use exponential backoff for 429 and 500 errors. Wait
2^attempt
seconds, maximum 3 retries.
json
{"type": "error", "message": "Failed to execute model: Invalid parameters", "error_code": "..."}
错误信息原因解决方案
Model execution failed
底层模型错误检查模型参数
Session not found
会话无效或已过期创建新会话
Workflow execution timeout
超过15分钟限制拆分为更小的工作流
重试策略: 对429和500错误使用指数退避,等待
2^attempt
秒,最多重试3次。

Timeouts

超时设置

Client timeout recommendation: Set your HTTP client timeout to minimum 10 minutes. Complex use cases may require running multiple AI models sequentially (e.g., 10+ model executions for UGC videos).
OperationTimeout
HTTP request300 seconds
Streaming idle15 minutes
Image generation10-60 seconds
Video generation60-600 seconds
Workflow execution15 minutes
bash
undefined
客户端超时建议: 将HTTP客户端超时设置为至少10分钟。复杂场景可能需要依次运行多个AI模型(例如,UGC视频可能需要执行10余次模型调用)。
操作超时时间
HTTP请求300秒
流式空闲超时15分钟
图像生成10-60秒
视频生成60-600秒
工作流执行15分钟
bash
undefined

curl example with 10 minute timeout

10分钟超时的curl示例

curl --max-time 600 -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Create a complex UGC video..."}], "model": "eachsense/beta", "stream": true }'
undefined
curl --max-time 600 -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions
-H "Content-Type: application/json"
-H "X-API-Key: $EACHLABS_API_KEY"
-H "Accept: text/event-stream"
-d '{ "messages": [{"role": "user", "content": "Create a complex UGC video..."}], "model": "eachsense/beta", "stream": true }'
undefined

Rate Limits

请求限制

PlanRequests/MinuteConcurrent
Free102
Pro6010
Enterprise30050
Rate limit headers:
X-RateLimit-Limit
,
X-RateLimit-Remaining
,
X-RateLimit-Reset
套餐每分钟请求数并发请求数
免费版102
专业版6010
企业版30050
请求限制响应头:
X-RateLimit-Limit
,
X-RateLimit-Remaining
,
X-RateLimit-Reset

Input Validation Limits

输入验证限制

Input TypeConstraint
Images per requestMax 4
Image formatsJPEG, PNG, WebP, GIF
Image sizeMax 20MB, 64-8192px
Video formatsMP4, WebM, MOV
Video sizeMax 500MB, 10 min
Audio formatsMP3, WAV, M4A, OGG
Audio sizeMax 50MB, 5 min
Prompt lengthMax 10,000 characters
Session memoryMax 50 messages
输入类型约束条件
单请求图片数量最多4张
图片格式JPEG、PNG、WebP、GIF
图片大小最大20MB,尺寸64-8192px
视频格式MP4、WebM、MOV
视频大小最大500MB,时长10分钟
音频格式MP3、WAV、M4A、OGG
音频大小最大50MB,时长5分钟
提示词长度最多10,000字符
会话记忆最多50条消息

Best Practices

最佳实践

  1. Use session_id for multi-turn conversations to maintain context
  2. Use ECO mode for prototyping and cost-sensitive applications
  3. Handle clarification events - respond with requested information in the same session
  4. Provide clear prompts - be specific about style, mood, and composition
  5. Monitor SSE events - use
    thinking_delta
    for progress,
    generation_response
    for output
  6. Use OpenAI SDK for easier integration - just point to the each::sense base URL
  7. Implement retry logic - use exponential backoff for transient errors
  1. 使用session_id 维护多轮对话的上下文
  2. 使用ECO模式 进行原型制作和对成本敏感的应用
  3. 处理澄清事件 - 在同一会话中响应所需信息
  4. 提供清晰的提示词 - 明确说明风格、情绪和构图
  5. 监控SSE事件 - 使用
    thinking_delta
    查看进度,
    generation_response
    获取输出
  6. 使用OpenAI SDK 简化集成 - 只需指向each::sense的基础URL
  7. 实现重试逻辑 - 对临时错误使用指数退避重试