🎨

Jimeng API 管理控制台

● 已登录
总请求
{{ stats.requests?.total || 0 }}
成功率
{{ successRate }}%
队列
{{ queueStatus.running }}/{{ queueStatus.maxConcurrency }}
Session
{{ sessions.filter(s=>s.enabled).length }}/{{ sessions.length }}

Session状态

{{ s.name }} ({{ s.region }}) {{ s.credits }}积分
暂无Session

最近错误

{{ e.code }}{{ e.count }}次
无错误 👍

Session管理

状态名称区域Token积分统计操作
{{ s.name }} {{ s.region.toUpperCase() }} {{ maskToken(s.token) }} {{ s.credits }} {{ s.successCount||0 }}/{{ s.failCount||0 }}
暂无Session

API Key管理

状态名称Key限流操作
{{ k.name }} {{ k.key }} {{ k.rateLimit || '无限制' }}
暂无API Key

模型配置

{{ m.displayName || m.id }}

{{ m.enabled?'启用':'禁用' }}

{{ m.id }}

类型{{ m.type==='image'?'图像':'视频' }}
积分
站点开关

暂无模型

任务监控

队列配置

{{ queueStatus.running }}
执行中
{{ queueStatus.queued }}
排队中
{{ queueStatus.maxConcurrency }}
最大并发
{{ queueStatus.maxQueueSize }}
队列容量

使用帮助

🚀 快速开始

  1. 获取SessionID:登录即梦AI网站,按F12打开开发者工具,在Application → Cookies中找到sessionid
  2. 添加Session:在Session管理页面添加获取的sessionid
  3. 创建API Key:在API Key页面创建用于调用API的密钥
  4. 调用API:使用Bearer Token认证调用OpenAI兼容接口

⚙️ 基础配置

API地址:http://localhost:5100

认证方式:Bearer Token(在请求头中添加 Authorization: Bearer YOUR_API_KEY

默认管理密码:admin123(生产环境请修改)

📋 获取模型列表

获取所有可用的模型列表

GET /v1/models

请求示例:

curl http://localhost:5100/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

成功响应:

{
  "object": "list",
  "data": [
    {
      "id": "jimeng-3.0",
      "object": "model",
      "created": 1704067200,
      "owned_by": "jimeng"
    },
    {
      "id": "jimeng-3.0-pro",
      "object": "model",
      "created": 1704067200,
      "owned_by": "jimeng"
    }
  ]
}

🎨 图像生成 API

使用文本提示生成图像(OpenAI兼容格式)

POST /v1/images/generations

请求参数:

参数类型必填说明
modelstring模型ID,如 jimeng-3.0, jimeng-3.0-pro
promptstring图像描述提示词
ninteger生成数量,默认1,最大4
sizestring图像尺寸,如 1024x1024
response_formatstringurl 或 b64_json

请求示例:

curl -X POST http://localhost:5100/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jimeng-3.0",
    "prompt": "一只可爱的橘猫,戴着圣诞帽,在雪地里玩耍",
    "n": 1,
    "size": "1024x1024"
  }'

✅ 成功响应:

{
  "created": 1704067200,
  "data": [
    {
      "url": "https://example.com/generated-image.png",
      "revised_prompt": "一只可爱的橘猫..."
    }
  ]
}

🎬 视频生成 API

使用文本提示生成视频

POST /v1/videos/generations

请求参数:

参数类型必填说明
modelstring模型ID,如 pixeldance
promptstring视频描述提示词
imagestring参考图像URL(图生视频)

请求示例:

curl -X POST http://localhost:5100/v1/videos/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "pixeldance",
    "prompt": "一只猫咪在草地上奔跑"
  }'

✅ 成功响应:

{
  "created": 1704067200,
  "data": [
    {
      "url": "https://example.com/generated-video.mp4"
    }
  ]
}

💬 Chat API(兼容模式)

使用OpenAI Chat格式调用图像生成

POST /v1/chat/completions

请求示例:

curl -X POST http://localhost:5100/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jimeng-3.0",
    "messages": [
      {
        "role": "user",
        "content": "画一只可爱的小猫"
      }
    ]
  }'

✅ 成功响应:

{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "created": 1704067200,
  "model": "jimeng-3.0",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "![image](https://example.com/image.png)"
      },
      "finish_reason": "stop"
    }
  ]
}

❌ 错误响应示例

认证失败 (401):

{
  "error": {
    "message": "Invalid API key",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}

请求参数错误 (400):

{
  "error": {
    "message": "Missing required parameter: prompt",
    "type": "invalid_request_error",
    "code": "missing_parameter"
  }
}

模型不存在 (404):

{
  "error": {
    "message": "Model 'xxx' not found",
    "type": "invalid_request_error",
    "code": "model_not_found"
  }
}

任务超时 (408):

{
  "error": {
    "message": "Task timeout after 120 seconds",
    "type": "timeout_error",
    "code": "task_timeout"
  }
}

队列已满 (429):

{
  "error": {
    "message": "Queue is full, please try again later",
    "type": "rate_limit_error",
    "code": "queue_full"
  }
}

Session积分不足 (402):

{
  "error": {
    "message": "No session available with sufficient credits",
    "type": "billing_error",
    "code": "insufficient_credits"
  }
}

服务器错误 (500):

{
  "error": {
    "message": "Internal server error",
    "type": "server_error",
    "code": "internal_error"
  }
}

🤖 支持的模型

图像生成模型:

  • jimeng-3.0 - 基础版
  • jimeng-3.0-pro - 专业版
  • jimeng-3.0-t2i-s - 极速版
  • jimeng-3.0-t2i-p - 高质量
  • jimeng-4.5 - 最新版本

视频生成模型:

  • pixeldance - 文生视频
  • seaweed - 图生视频

💻 编程语言示例

Python:

import openai

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="http://localhost:5100/v1"
)

# 生成图像
response = client.images.generate(
    model="jimeng-3.0",
    prompt="一只可爱的小猫",
    n=1,
    size="1024x1024"
)

print(response.data[0].url)

JavaScript/Node.js:

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'http://localhost:5100/v1'
});

const response = await client.images.generate({
  model: 'jimeng-3.0',
  prompt: '一只可爱的小猫',
  n: 1,
  size: '1024x1024'
});

console.log(response.data[0].url);

使用 fetch:

const response = await fetch('http://localhost:5100/v1/images/generations', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'jimeng-3.0',
    prompt: '一只可爱的小猫',
    n: 1,
    size: '1024x1024'
  })
});

const data = await response.json();
console.log(data.data[0].url);

🐳 Docker 部署

使用 docker-compose:

# 设置环境变量
export ADMIN_PASSWORD=your_secure_password

# 启动服务
docker-compose up -d

# 查看日志
docker-compose logs -f

使用 docker run:

docker run -d \
  --name jimeng-api \
  -p 5100:5100 \
  -e ADMIN_PASSWORD=your_password \
  -v jimeng-data:/app/data \
  jimeng-api:latest

⚠️ 注意事项

  • SessionID有效期有限,请定期检查和更新
  • 每个Session都有积分限制,系统会自动轮询可用Session
  • 图像生成通常需要10-60秒,视频生成可能需要更长时间
  • 并发请求数受任务队列限制,超出会排队等待
  • 生产环境请务必修改默认管理密码
  • 建议配置多个Session以提高可用性

管理员登录

编辑Session

添加Session

创建API Key

API Key 创建成功

仅显示一次,请立即复制保存

{{ createdApiKey }}

添加模型

{{ toast.message }}