each-sense
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseeach::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 environment variable.
EACHLABS_API_KEYHeader: X-API-Key: <your-api-key>同时支持兼容OpenAI SDK的身份验证方式:
Header: Authorization: Bearer <your-api-key>可前往 eachlabs.ai 获取你的API密钥。
设置环境变量 。
EACHLABS_API_KEYBase URL
基础URL
https://eachsense-agent.core.eachlabs.runhttps://eachsense-agent.core.eachlabs.runEndpoints
端点
| Method | Path | Purpose |
|---|---|---|
| POST | | Primary chat endpoint |
| POST | | Workflow builder |
| GET | | List available models |
| GET | | Retrieve session memory |
| DELETE | | Clear session memory |
| GET | | List all sessions |
| 请求方法 | 路径 | 用途 |
|---|---|---|
| POST | | 主要对话端点 |
| POST | | 工作流构建器 |
| GET | | 列出可用模型 |
| GET | | 获取会话记忆 |
| DELETE | | 清除会话记忆 |
| GET | | 列出所有会话 |
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"])
undefinedstream = 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"])
undefinedUsing 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
参数详情
| Parameter | Type | Default | Description |
|---|---|---|---|
| array | required | Chat messages with |
| string | "eachsense/beta" | Model identifier |
| boolean | true | Enable SSE streaming |
| string | null | Session ID for conversation history. Use to continue previous chats, handle clarifications, and iteratively refine outputs |
| string | "max" | |
| string | "agent" | |
| array | null | URLs of images to process/edit (max 4) |
| string | null | Execute a specific workflow |
| string | null | Workflow version, used with workflow_id |
| boolean | true | Allow web search for information |
| boolean | true | Set to false to allow NSFW content generation |
OpenAI SDK extra parameters: When using the OpenAI SDK, pass non-standard parameters via :
extra_bodypython
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
)| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| 数组 | 必填 | 包含 |
| 字符串 | "eachsense/beta" | 模型标识符 |
| 布尔值 | true | 启用SSE流式传输 |
| 字符串 | null | 对话历史的会话ID,用于继续之前的对话、处理澄清请求及迭代优化输出 |
| 字符串 | "max" | |
| 字符串 | "agent" | |
| 数组 | null | 待处理/编辑的图片URL(最多4个) |
| 字符串 | null | 执行特定工作流 |
| 字符串 | null | 工作流版本,需与workflow_id配合使用 |
| 布尔值 | true | 是否允许通过网页搜索获取信息 |
| 布尔值 | true | 设置为false以允许生成NSFW内容 |
OpenAI SDK额外参数: 使用OpenAI SDK时,通过传递非标准参数:
extra_bodypython
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 to maintain conversation history and context across multiple requests. This enables:
session_id- Multi-turn conversations: Follow-up on previous requests without repeating context
- Iterative refinement: Ask for modifications to previously generated content
- Clarification flows: Respond to events and continue the conversation
clarification_needed - Context awareness: The AI remembers previous generations, preferences, and instructions
使用在多次请求间维护对话历史和上下文,支持:
session_id- 多轮对话:无需重复上下文即可跟进之前的请求
- 迭代优化:请求修改之前生成的内容
- 澄清流程:响应事件并继续对话
clarification_needed - 上下文感知:AI会记住之前的生成内容、偏好和指令
Session Limits
会话限制
| Metric | Limit |
|---|---|
| Idle timeout | 15 minutes |
| Session TTL | 30 days |
| Messages per session | 50 |
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
undefinedbash
undefinedRetrieve session memory
获取会话记忆
curl https://eachsense-agent.core.eachlabs.run/memory?session_id=my-session
-H "X-API-Key: $EACHLABS_API_KEY"
-H "X-API-Key: $EACHLABS_API_KEY"
curl https://eachsense-agent.core.eachlabs.run/memory?session_id=my-session
-H "X-API-Key: $EACHLABS_API_KEY"
-H "X-API-Key: $EACHLABS_API_KEY"
Clear session memory
清除会话记忆
curl -X DELETE https://eachsense-agent.core.eachlabs.run/memory?session_id=my-session
-H "X-API-Key: $EACHLABS_API_KEY"
-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"
-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"
-H "X-API-Key: $EACHLABS_API_KEY"
undefinedcurl https://eachsense-agent.core.eachlabs.run/sessions
-H "X-API-Key: $EACHLABS_API_KEY"
-H "X-API-Key: $EACHLABS_API_KEY"
undefinedExample: Iterative Generation
示例:迭代生成
bash
undefinedbash
undefinedFirst 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" }'
-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" }'
-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" }'
-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" }'
-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" }'
-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" }'
undefinedcurl -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" }'
-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" }'
undefinedExample: Handling Clarifications
示例:处理澄清请求
bash
undefinedbash
undefinedAmbiguous 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"] }'
-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"] }'
-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"] }'
-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"] }'
undefinedcurl -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"] }'
-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"] }'
undefinedUse 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 format with an extension field.
chat.completion.chunkeachlabsEach event has the format:
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","choices":[{"delta":{"content":""}}],"eachlabs":{"type":"event_type",...}}\n\nStream ends with:
data: [DONE]\n\n端点返回封装在OpenAI 格式中的Server-Sent Events(SSE),带有扩展字段。
chat.completion.chunkeachlabs每个事件格式如下:
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","choices":[{"delta":{"content":""}}],"eachlabs":{"type":"event_type",...}}\n\n流结束时返回:
data: [DONE]\n\nEvent Types (18 Total)
事件类型(共18种)
AI Reasoning:
| Event | Description |
|---|---|
| AI reasoning in real-time |
| Text content (explanations, answers) |
Tool Operations:
| Event | Description |
|---|---|
| Current operation being executed (includes |
| Details of tool being called |
| Informational message |
| Progress update with |
Generation:
| Event | Description |
|---|---|
| Generated media URL ( |
Interaction:
| Event | Description |
|---|---|
| AI needs more information ( |
Web Search:
| Event | Description |
|---|---|
| Web search being executed |
| Citations with |
Workflow:
| Event | Description |
|---|---|
| New workflow created |
| Existing workflow loaded |
| Workflow definition constructed |
| Workflow pushed to API |
Execution:
| Event | Description |
|---|---|
| Workflow execution began |
| Step progress ( |
| Workflow done ( |
Terminal:
| Event | Description |
|---|---|
| Task finished ( |
| Error occurred ( |
AI推理:
| 事件 | 说明 |
|---|---|
| AI实时推理过程 |
| 文本内容(解释、回答) |
工具操作:
| 事件 | 说明 |
|---|---|
| 当前正在执行的操作(包含 |
| 调用工具的详细信息 |
| 信息提示 |
| 进度更新,包含 |
生成操作:
| 事件 | 说明 |
|---|---|
| 生成的媒体URL( |
交互操作:
| 事件 | 说明 |
|---|---|
| AI需要更多信息( |
网页搜索:
| 事件 | 说明 |
|---|---|
| 正在执行的网页搜索 |
| 引用信息,包含 |
工作流:
| 事件 | 说明 |
|---|---|
| 已创建新工作流 |
| 已加载现有工作流 |
| 已构建工作流定义 |
| 已推送工作流至API |
执行操作:
| 事件 | 说明 |
|---|---|
| 工作流已开始执行 |
| 步骤进度( |
| 工作流已完成( |
终端事件:
| 事件 | 说明 |
|---|---|
| 任务已完成( |
| 发生错误( |
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工具
| Tool | Type | Purpose |
|---|---|---|
| Non-terminal | Find models by use case |
| Non-terminal | Get model input schema |
| Non-terminal | Web search |
| Non-terminal | Analyze image content |
| Terminal | Run model prediction |
| Terminal | Generate text response |
| Non-terminal | Create workflow |
| Non-terminal | Execute workflow |
| Non-terminal | Build workflow definition |
| Non-terminal | Check execution status |
| Terminal | Request clarification |
| 工具 | 类型 | 用途 |
|---|---|---|
| 非终端 | 根据使用场景查找模型 |
| 非终端 | 获取模型输入Schema |
| 非终端 | 网页搜索 |
| 非终端 | 分析图像内容 |
| 终端 | 运行模型预测 |
| 终端 | 生成文本响应 |
| 非终端 | 创建工作流 |
| 非终端 | 执行工作流 |
| 非终端 | 构建工作流定义 |
| 非终端 | 检查执行状态 |
| 终端 | 请求澄清信息 |
Model Quick Reference
模型快速参考
| Use Case | Model Slug | Speed |
|---|---|---|
| Best image quality | | Medium |
| Fast image generation | | Fast |
| Text/logos in images | | Fast |
| Rapid prototyping | | Very Fast |
| Photorealistic images | | Medium |
| Artistic/creative | | Medium |
| Best video (with audio) | | Slow |
| Fast video | | Fast |
| High-quality video | | Medium |
| Image to video | | Medium |
| Instruction editing | | Fast |
| Background removal | | Very Fast |
| Image upscaling | | Fast |
| Face swap | | Fast |
| Text-to-speech | | Very Fast |
| Music generation | | Medium |
| 使用场景 | 模型标识 | 速度 |
|---|---|---|
| 最佳图像质量 | | 中等 |
| 快速图像生成 | | 快速 |
| 图像中生成文字/Logo | | 快速 |
| 快速原型制作 | | 极快 |
| 写实风格图像 | | 中等 |
| 艺术/创意风格 | | 中等 |
| 最佳视频(含音频) | | 慢速 |
| 快速视频生成 | | 快速 |
| 高质量视频 | | 中等 |
| 图像转视频 | | 中等 |
| 指令式编辑 | | 快速 |
| 背景移除 | | 极快 |
| 图像放大 | | 快速 |
| 人脸替换 | | 快速 |
| 文本转语音 | | 极快 |
| 音乐生成 | | 中等 |
Model Aliases
模型别名
Common shorthand names that are automatically resolved:
| Alias | Resolves To |
|---|---|
| Flux Max | flux-2-max |
| Flux Pro | flux-2-pro |
| Flux Edit | flux-2-edit |
| Flux Fill | flux-fill-pro |
| Flux Kontext | flux-kontext-pro |
| Imagen 4 | gemini-imagen-4 |
| Veo 3 | veo-3 |
| Kling 3 | kling-3-0 |
| Sora | sora-2-pro |
| ElevenLabs | elevenlabs-tts |
自动解析的常用简写名称:
| 别名 | 解析为 |
|---|---|
| Flux Max | flux-2-max |
| Flux Pro | flux-2-pro |
| Flux Edit | flux-2-edit |
| Flux Fill | flux-fill-pro |
| Flux Kontext | flux-kontext-pro |
| Imagen 4 | gemini-imagen-4 |
| Veo 3 | veo-3 |
| Kling 3 | kling-3-0 |
| Sora | sora-2-pro |
| ElevenLabs | elevenlabs-tts |
Error Handling
错误处理
HTTP Errors
HTTP错误
| Code | Response | Cause |
|---|---|---|
| 401 | | Missing or invalid API key |
| 422 | | Missing required fields or invalid parameters |
| 429 | | Rate limited - implement exponential backoff |
| 500 | | Internal server error - retry with backoff |
| 状态码 | 响应内容 | 原因 |
|---|---|---|
| 401 | | API密钥缺失或无效 |
| 422 | | 缺少必填字段或参数无效 |
| 429 | | 请求超限 - 实现指数退避重试 |
| 500 | | 服务器内部错误 - 退避后重试 |
Streaming Errors
流式错误
json
{"type": "error", "message": "Failed to execute model: Invalid parameters", "error_code": "..."}| Error Message | Cause | Solution |
|---|---|---|
| Underlying model error | Check model parameters |
| Invalid or expired session | Create new session |
| Exceeded 15 minute limit | Split into smaller workflows |
Retry strategy: Use exponential backoff for 429 and 500 errors. Wait seconds, maximum 3 retries.
2^attemptjson
{"type": "error", "message": "Failed to execute model: Invalid parameters", "error_code": "..."}| 错误信息 | 原因 | 解决方案 |
|---|---|---|
| 底层模型错误 | 检查模型参数 |
| 会话无效或已过期 | 创建新会话 |
| 超过15分钟限制 | 拆分为更小的工作流 |
重试策略: 对429和500错误使用指数退避,等待秒,最多重试3次。
2^attemptTimeouts
超时设置
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).
| Operation | Timeout |
|---|---|
| HTTP request | 300 seconds |
| Streaming idle | 15 minutes |
| Image generation | 10-60 seconds |
| Video generation | 60-600 seconds |
| Workflow execution | 15 minutes |
bash
undefined客户端超时建议: 将HTTP客户端超时设置为至少10分钟。复杂场景可能需要依次运行多个AI模型(例如,UGC视频可能需要执行10余次模型调用)。
| 操作 | 超时时间 |
|---|---|
| HTTP请求 | 300秒 |
| 流式空闲超时 | 15分钟 |
| 图像生成 | 10-60秒 |
| 视频生成 | 60-600秒 |
| 工作流执行 | 15分钟 |
bash
undefinedcurl 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 }'
-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 }'
undefinedcurl --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 }'
-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 }'
undefinedRate Limits
请求限制
| Plan | Requests/Minute | Concurrent |
|---|---|---|
| Free | 10 | 2 |
| Pro | 60 | 10 |
| Enterprise | 300 | 50 |
Rate limit headers: , ,
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-Reset| 套餐 | 每分钟请求数 | 并发请求数 |
|---|---|---|
| 免费版 | 10 | 2 |
| 专业版 | 60 | 10 |
| 企业版 | 300 | 50 |
请求限制响应头:, ,
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-ResetInput Validation Limits
输入验证限制
| Input Type | Constraint |
|---|---|
| Images per request | Max 4 |
| Image formats | JPEG, PNG, WebP, GIF |
| Image size | Max 20MB, 64-8192px |
| Video formats | MP4, WebM, MOV |
| Video size | Max 500MB, 10 min |
| Audio formats | MP3, WAV, M4A, OGG |
| Audio size | Max 50MB, 5 min |
| Prompt length | Max 10,000 characters |
| Session memory | Max 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
最佳实践
- Use session_id for multi-turn conversations to maintain context
- Use ECO mode for prototyping and cost-sensitive applications
- Handle clarification events - respond with requested information in the same session
- Provide clear prompts - be specific about style, mood, and composition
- Monitor SSE events - use for progress,
thinking_deltafor outputgeneration_response - Use OpenAI SDK for easier integration - just point to the each::sense base URL
- Implement retry logic - use exponential backoff for transient errors
- 使用session_id 维护多轮对话的上下文
- 使用ECO模式 进行原型制作和对成本敏感的应用
- 处理澄清事件 - 在同一会话中响应所需信息
- 提供清晰的提示词 - 明确说明风格、情绪和构图
- 监控SSE事件 - 使用查看进度,
thinking_delta获取输出generation_response - 使用OpenAI SDK 简化集成 - 只需指向each::sense的基础URL
- 实现重试逻辑 - 对临时错误使用指数退避重试