跳转到主要内容

概述

SeeDream 是来自 BytePlus 火山方舟海外版的高品质图像生成模型系列,API易已达成官方战略合作,提供稳定可靠的服务。

可用版本

SeeDream 4.5

最新版本(推荐)
  • 模型名称:seedream-4-5-251128
  • 更强的 4K 图像生成能力
  • 价格:$0.035/张(折扣前¥0.245/张)
  • 🔥 最佳画质和细节表现

SeeDream 4.0

稳定版本
  • 模型名称:seedream-4-0-250828
  • 高品质 4K 图像生成
  • 价格:$0.03/张(折扣前¥0.21/张)
  • ✅ 经过验证的稳定表现
🔥 2025年12月4日重大更新:SeeDream 4.5 震撼上线!更强的 4K 图像生成能力,画质和细节表现进一步提升。官方提供 200 张免费图片测试额度。

📚 最新文档

飞书完整使用指南 - 更新最快,支持评论互动访问飞书文档获取最新的使用教程、技巧分享和问题解答。文档持续更新,遇到问题可直接在飞书上评论交流。

核心优势
  • 🔥 SeeDream 4.5 最新升级:更强的 4K 图像生成能力,画质和细节表现显著提升
  • 🎨 高品质出图:4K 高清图像生成,视觉一致性优秀,细节丰富
  • 💰 价格优势:4.5 版本 $0.035/张,4.0 版本 $0.03/张
  • 🚀 生成速度:平均 15 秒左右一张图,响应迅速
  • 🤝 官方合作:BytePlus 火山方舟战略合作,资源可靠稳定
  • 🔧 标准接口:完全兼容 OpenAI Image API 格式
  • 🎁 免费测试:官方提供 200 张免费图片测试额度

调用方式

正确端点 ✅

POST /v1/images/generations
重要提示:SeeDream 4.0 使用标准的 OpenAI 图像生成端点,完全兼容 OpenAI Image API 格式,按次计费,简单透明。

Python 示例代码

以下是完整的 Python 示例代码,展示如何使用 SeeDream 4.0 生成图像:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
SeeDream 4.0 图片生成 - Python版本
支持标准 OpenAI Image API 格式
"""

import requests
import json
import base64
import os
import datetime
from typing import Optional, Dict, Any

class SeeDreamImageGenerator:
    def __init__(self, api_key: str, api_url: str = "https://api.apiyi.com/v1/images/generations"):
        """
        初始化 SeeDream 图片生成器

        Args:
            api_key: API密钥
            api_url: API地址
        """
        self.api_key = api_key
        self.api_url = api_url
        self.headers = {
            "Content-Type": "application/json",
            "Authorization": f"Bearer {api_key}"
        }

    def generate_image(self,
                      prompt: str,
                      model: str = "seedream-4-5-251128",
                      size: str = "2048x2048",
                      quality: str = "standard",
                      n: int = 1,
                      response_format: str = "url",
                      output_dir: str = ".") -> Dict[str, Any]:
        """
        生成图片

        Args:
            prompt: 图片描述提示词
            model: 使用的模型
            size: 图片尺寸
                  方法1: 分辨率规格 ("1K", "2K", "4K") - 让模型根据提示词决定最终尺寸
                  方法2: 精确像素 ("2048x2048", "1920x1080" 等) - 范围[1280x720, 4096x4096]
            quality: 图片质量 (standard 或 hd)
            n: 生成数量
            response_format: 响应格式 (url 或 b64_json)
            output_dir: 输出目录(仅当response_format为b64_json时使用)

        Returns:
            API响应结果
        """
        print("🚀 开始生成图片...")
        print(f"提示词: {prompt}")
        print(f"模型: {model}")
        print(f"尺寸: {size}")
        print(f"质量: {quality}")

        try:
            # 准备请求数据
            payload = {
                "model": model,
                "prompt": prompt,
                "size": size,
                "quality": quality,
                "n": n,
                "response_format": response_format
            }

            print("📡 发送API请求...")

            # 发送请求
            response = requests.post(
                self.api_url,
                headers=self.headers,
                json=payload,
                timeout=60
            )

            if response.status_code != 200:
                error_msg = f"API请求失败,状态码: {response.status_code}"
                try:
                    error_detail = response.json()
                    error_msg += f", 错误详情: {error_detail}"
                except:
                    error_msg += f", 响应内容: {response.text[:500]}"
                print(f"❌ {error_msg}")
                return {"error": error_msg}

            print("✅ API请求成功")

            # 解析响应
            result = response.json()

            # 处理响应数据
            if response_format == "b64_json" and "data" in result:
                print("🔍 正在保存base64图片...")
                for i, item in enumerate(result["data"]):
                    if "b64_json" in item:
                        self._save_base64_image(
                            item["b64_json"],
                            output_dir,
                            f"seedream_{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}_{i}.png"
                        )
            elif response_format == "url" and "data" in result:
                print("🎨 生成的图片URL:")
                for item in result["data"]:
                    if "url" in item:
                        print(f"  🔗 {item['url']}")

            return result

        except requests.exceptions.Timeout:
            error_msg = "请求超时(60秒)"
            print(f"❌ {error_msg}")
            return {"error": error_msg}
        except requests.exceptions.ConnectionError as e:
            error_msg = f"连接错误: {str(e)}"
            print(f"❌ {error_msg}")
            return {"error": error_msg}
        except Exception as e:
            error_msg = f"未知错误: {str(e)}"
            print(f"❌ {error_msg}")
            return {"error": error_msg}

    def _save_base64_image(self, b64_data: str, output_dir: str, filename: str):
        """
        保存base64图片到本地

        Args:
            b64_data: base64编码的图片数据
            output_dir: 输出目录
            filename: 文件名
        """
        try:
            # 解码base64数据
            image_data = base64.b64decode(b64_data)

            # 创建输出目录
            os.makedirs(output_dir, exist_ok=True)

            # 保存文件
            output_path = os.path.join(output_dir, filename)
            with open(output_path, 'wb') as f:
                f.write(image_data)

            print(f"🖼️  图片保存成功: {output_path}")
            print(f"📊 文件大小: {len(image_data)} 字节")

        except Exception as e:
            print(f"❌ 保存图片失败: {str(e)}")

def main():
    """
    主函数 - 演示 SeeDream 4.0 图片生成
    """
    # 配置参数
    API_KEY = "sk-"  # 请替换为你的实际API密钥

    # 示例提示词
    prompts = [
        "A serene Japanese garden with cherry blossoms in full bloom, koi pond, traditional bridge, 4K, ultra detailed",
        "Futuristic cityscape at night with neon lights and flying vehicles, cyberpunk style, high quality",
        "Cute cartoon cat astronaut floating in space with planets in background, pixar style"
    ]

    print("="*60)
    print("SeeDream 4.0 图片生成器 - Python版本")
    print("="*60)
    print(f"开始时间: {datetime.datetime.now()}")

    # 创建生成器实例
    generator = SeeDreamImageGenerator(API_KEY)

    # 生成示例图片
    for i, prompt in enumerate(prompts, 1):
        print(f"\n🎯 示例 {i}/{len(prompts)}")
        print("-"*40)

        result = generator.generate_image(
            prompt=prompt,
            size="2K",          # 可选: "1K", "2K", "4K" 或精确尺寸如 "2048x2048"
            quality="hd",       # 可选: standard, hd
            n=1,                # 生成数量
            response_format="url"  # 可选: url, b64_json
        )

        if "error" not in result:
            print(f"✅ 图片 {i} 生成成功!")
        else:
            print(f"❌ 图片 {i} 生成失败")

        print("-"*40)

    print(f"\n结束时间: {datetime.datetime.now()}")
    print("="*60)

if __name__ == "__main__":
    main()

使用步骤

  1. 替换 API Key:将代码中的 API_KEY 替换为你的实际 API 密钥
  2. 设置参数
    • prompt: 详细描述你想要生成的图片
    • size: 选择图片尺寸
      • 方法1:使用分辨率规格 (“1K”, “2K”, “4K”) - 模型根据提示词自动决定宽高比
      • 方法2:指定精确像素 (如 “2048x2048”) - 总像素范围 [1280×720, 4096×4096],宽高比范围 [1/16, 16]
    • quality: 选择质量等级(standard 或 hd)
    • response_format: 选择返回格式(url 或 b64_json)
  3. 运行脚本:执行 Python 脚本即可生成图片

cURL 示例

如果你更喜欢使用 cURL 命令行工具:
curl -X POST "https://api.apiyi.com/v1/images/generations" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "seedream-4-5-251128",
    "prompt": "A beautiful sunset over mountains with dramatic clouds",
    "size": "4K",
    "quality": "hd",
    "n": 1,
    "response_format": "url"
  }'

价格对比

模型官网价格API易价格折扣特点
SeeDream 4.5-$0.035/张-🔥 更强 4K 能力,画质提升
SeeDream 4.0$0.03/张$0.03/张官网同价⭐ 4K高清,视觉一致性优秀
Nano Banana Pro$0.24/张(4K)$0.05/张21%谷歌 4K 高清
Nano Banana$0.04/张$0.025/张62.5%谷歌技术,10秒快速
GPT-Image-1更高--OpenAI 技术
版本选择建议
  • 最佳画质:推荐使用 SeeDream 4.5,更强的 4K 图像生成能力
  • 稳定性价比:SeeDream 4.0 提供经过验证的稳定表现,价格更优
  • 结合充值加赠:实际成本分别约 ¥0.21/张(4.5)和 ¥0.18/张(4.0)

特性对比

质量特点

  • 4K 高清输出:支持高分辨率图像生成
  • 视觉一致性:生成的图片风格统一,细节丰富
  • 响应速度:15秒左右完成生成,速度适中

API 特性

  • ✅ 标准 OpenAI Image API 格式
  • ✅ 支持多种图片尺寸
  • ✅ 支持 URL 和 Base64 两种返回格式
  • ✅ 按次计费,透明简单
  • ✅ 批量生成支持(n 参数)

支持的尺寸

SeeDream 4.0 支持两种尺寸设置方式:

方法1:分辨率规格

使用分辨率规格,让模型根据提示词中的描述自动决定最佳宽高比:
  • 1K - 约 1024×1024 像素
  • 2K - 约 2048×2048 像素
  • 4K - 约 4096×4096 像素

方法2:精确像素尺寸

直接指定宽度和高度(单位:像素):
  • 默认值2048x2048
  • 总像素范围:[1280×720, 4096×4096]
  • 宽高比范围:[1/16, 16]

常用尺寸示例:

  • 2048x2048 - 正方形(默认)
  • 1920x1080 - 16:9 横屏(Full HD)
  • 3840x2160 - 16:9 横屏(4K)
  • 1080x1920 - 9:16 竖屏(手机屏幕)
  • 2560x1440 - 16:9 横屏(2K)
注意:两种方法不能同时使用。选择其中一种即可。

常见问题

SeeDream 4.5 (最新版本):
  • 更强的 4K 图像生成能力
  • 画质和细节表现显著提升
  • 价格:$0.035/张
  • 推荐追求最佳画质的用户使用
SeeDream 4.0 (稳定版本):
  • 经过验证的稳定表现
  • 优秀的视觉一致性
  • 价格:$0.03/张(官网同价)
  • 推荐追求性价比的用户使用
推荐使用 SeeDream 4.5
  • 需要最佳画质和细节表现
  • 专业设计、广告、商业用途
  • 对图片质量要求极高的场景
可以使用 SeeDream 4.0
  • 追求性价比
  • 日常图片生成需求
  • 对画质要求适中的场景
根据使用场景选择:
  • 快速生成:使用分辨率规格(“1K”, “2K”, “4K”),让模型自动决定
  • 精确控制:使用像素尺寸
    • 社交媒体头像:2048x2048
    • 横幅、封面:3840x2160 或 2560x1440
    • 手机壁纸:1080x1920
    • 桌面壁纸:1920x1080 或 3840x2160
是的,通过设置 n 参数可以一次生成多张图片(建议不超过4张以保证稳定性)。
通过 API 生成的图片,用户拥有完整的使用权,可用于商业和非商业用途。

最佳实践

提示词优化

  1. 详细描述:提供具体的场景、风格、颜色等描述
  2. 添加质量标签:如 “4K”, “ultra detailed”, “high quality”
  3. 指定风格:如 “photorealistic”, “cartoon style”, “oil painting”
  4. 包含光线信息:如 “golden hour”, “soft lighting”, “dramatic shadows”

示例提示词

好的提示词:
"A majestic mountain landscape at golden hour, snow-capped peaks reflecting
warm sunlight, crystal clear lake in foreground, pine forests, ultra detailed,
4K resolution, photorealistic"

简单提示词:
"mountain landscape"  # 结果可能不够理想

相关资源

SeeDream 4.0-4.5 是 API易与 BytePlus 火山方舟达成战略合作后推出的高品质图像生成服务。SeeDream 4.5 于 2025年11月28日正式上线,提供更强的 4K 图像生成能力。如有问题或建议,欢迎访问飞书文档留言交流。