Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ Clients connect with their own Bearer token — the server extracts the token fr

| Model | Version | Type | Best For | Price |
|-------|---------|------|----------|-------|
| `doubao-seedream-5-0-260128` | v5.0 | Text-to-Image | Latest quality, 3K, web search | ~$0.040/image |
| `doubao-seedream-4-5-251128` | v4.5 | Text-to-Image | Best quality, flagship | ~$0.037/image |
| `doubao-seedream-4-0-250828` | v4.0 | Text-to-Image | Best value, most tasks | ~$0.030/image |
| `doubao-seedream-3-0-t2i-250415` | v3.0 | Text-to-Image | Reproducible results | ~$0.038/image |
Expand Down
17 changes: 15 additions & 2 deletions core/types.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
"""Type definitions for Seedream MCP server."""

from typing import Literal
from typing import Literal, TypedDict

# Seedream model types
SeedreamModel = Literal[
"doubao-seedream-5-0-260128",
"doubao-seedream-4-5-251128",
"doubao-seedream-4-0-250828",
"doubao-seedream-3-0-t2i-250415",
"doubao-seededit-3-0-i2i-250628",
]

# Image size presets
SeedreamSize = Literal["1K", "2K", "4K", "adaptive"]
SeedreamSize = Literal["1K", "2K", "3K", "4K", "adaptive"]

# Output image format
OutputFormat = Literal["jpeg", "png"]

# Sequential image generation mode
SequentialMode = Literal["auto", "disabled"]
Expand All @@ -21,3 +25,12 @@

# Task action types
TaskAction = Literal["retrieve", "retrieve_batch"]

# Tool type for model tools (e.g., web_search)
ToolType = Literal["web_search"]


class ToolConfig(TypedDict):
"""Configuration for a model tool (e.g., web_search)."""

type: ToolType
43 changes: 36 additions & 7 deletions tools/image_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@

from core.client import client
from core.server import mcp
from core.types import ResponseFormat, SeedreamModel, SeedreamSize, SequentialMode
from core.types import (
OutputFormat,
ResponseFormat,
SeedreamModel,
SeedreamSize,
SequentialMode,
ToolConfig,
)
from core.utils import format_image_result


Expand All @@ -25,17 +32,19 @@ async def seedream_generate_image(
SeedreamModel,
Field(
description="Model to use for generation. "
"'doubao-seedream-4-5-251128' (v4.5, latest flagship, best quality). "
"'doubao-seedream-5-0-260128' (v5.0, latest flagship, best quality, supports 3K/web_search). "
"'doubao-seedream-4-5-251128' (v4.5, high quality, sequential generation, streaming). "
"'doubao-seedream-4-0-250828' (v4.0, stable, best value). "
"'doubao-seedream-3-0-t2i-250415' (v3 text-to-image, supports seed and guidance_scale). "
"'doubao-seededit-3-0-i2i-250628' is for image editing only — use seedream_edit_image "
"instead."
),
] = "doubao-seedream-4-0-250828",
] = "doubao-seedream-5-0-260128",
size: Annotated[
SeedreamSize | None,
Field(
description="Output image resolution. '1K' (default), '2K', '4K', or 'adaptive'. "
description="Output image resolution. '1K' (default), '2K', '3K', '4K', or 'adaptive'. "
"'3K' is only supported for v5.0 (doubao-seedream-5-0-260128). "
"You can also specify custom dimensions like '1024x1024', '1280x720', etc."
),
] = None,
Expand All @@ -51,14 +60,14 @@ async def seedream_generate_image(
SequentialMode | None,
Field(
description="Generate related images based on input. 'auto' enables it, 'disabled' "
"(default) turns it off. Only supports v4.5 and v4.0 models."
"(default) turns it off. Only supports v5.0, v4.5, and v4.0 models."
),
] = None,
stream: Annotated[
bool | None,
Field(
description="Stream all pictures progressively. Default is false. "
"Only supports v4.5 and v4.0 models."
"Only supports v5.0, v4.5, and v4.0 models."
),
] = None,
guidance_scale: Annotated[
Expand All @@ -80,6 +89,21 @@ async def seedream_generate_image(
bool | None,
Field(description="Whether to add an AI-generated watermark. Default is true."),
] = None,
output_format: Annotated[
OutputFormat | None,
Field(
description="Output image file format. 'jpeg' (default) or 'png'. "
"Only supported for v5.0 (doubao-seedream-5-0-260128)."
),
] = None,
tools: Annotated[
list[ToolConfig] | None,
Field(
description="Tools for the model to use. Currently only supports "
"[{'type': 'web_search'}] to enable web search. "
"Only supported for v5.0 (doubao-seedream-5-0-260128)."
),
] = None,
callback_url: Annotated[
str,
Field(
Expand All @@ -105,7 +129,8 @@ async def seedream_generate_image(
- You need to combine multiple images (use seedream_edit_image instead)

Model selection guide:
- v4.5 (doubao-seedream-4-5-251128): Latest flagship, best quality and detail
- v5.0 (doubao-seedream-5-0-260128): Latest flagship, best quality, supports 3K and web_search
- v4.5 (doubao-seedream-4-5-251128): High quality, sequential generation and streaming
- v4.0 (doubao-seedream-4-0-250828): Stable and cost-effective, great for most tasks
- v3 T2I (doubao-seedream-3-0-t2i-250415): Supports seed for reproducibility

Expand All @@ -132,6 +157,10 @@ async def seedream_generate_image(
payload["response_format"] = response_format
if watermark is not None:
payload["watermark"] = watermark
if output_format is not None:
payload["output_format"] = output_format
if tools is not None:
payload["tools"] = tools
if callback_url:
payload["callback_url"] = callback_url

Expand Down
33 changes: 21 additions & 12 deletions tools/info_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,28 @@ async def seedream_list_models() -> str:

| Model | Version | Type | Features | Price |
|-------|---------|------|----------|-------|
| `doubao-seedream-4-5-251128` | v4.5 | Text-to-Image | Latest flagship, best quality, sequential generation, streaming | ~$0.037/image |
| `doubao-seedream-5-0-260128` | v5.0 | Text-to-Image | Latest flagship, best quality, 3K resolution, web search, sequential generation, streaming | ~$0.040/image |
| `doubao-seedream-4-5-251128` | v4.5 | Text-to-Image | High quality, sequential generation, streaming | ~$0.037/image |
| `doubao-seedream-4-0-250828` | v4.0 | Text-to-Image | Stable, cost-effective, sequential generation, streaming | ~$0.030/image |
| `doubao-seedream-3-0-t2i-250415` | v3.0 | Text-to-Image | Seed control, guidance scale, reproducible results | ~$0.038/image |
| `doubao-seededit-3-0-i2i-250628` | v3.0 | Image-to-Image | Image editing, style transfer, seed control, guidance scale | ~$0.046/image |

## Model Selection Guide

### For Best Quality
→ **doubao-seedream-4-5-251128** (v4.5)
→ **doubao-seedream-5-0-260128** (v5.0)
- Latest flagship model with cutting-edge quality
- Best for professional/commercial use
- Supports 3K resolution and web search

### For High Quality
→ **doubao-seedream-4-5-251128** (v4.5)
- Excellent quality with sequential generation

### For Best Value
→ **doubao-seedream-4-0-250828** (v4.0)
- Great balance of quality and cost
- Recommended for most use cases
- Recommended for cost-effective use cases

### For Reproducible Results
→ **doubao-seedream-3-0-t2i-250415** (v3.0 T2I)
Expand All @@ -49,15 +55,17 @@ async def seedream_list_models() -> str:

## Feature Comparison

| Feature | v4.5 | v4.0 | v3.0 T2I | v3.0 I2I (Edit) |
|---------|------|------|----------|-----------------|
| Text-to-Image | ✅ | ✅ | ✅ | ❌ |
| Image Editing | ❌ | ❌ | ❌ | ✅ |
| Seed Control | ❌ | ❌ | ✅ | ✅ |
| Guidance Scale | ❌ | ❌ | ✅ (default 2.5) | ✅ (default 5.5) |
| Sequential Gen | ✅ | ✅ | ❌ | ❌ |
| Streaming | ✅ | ✅ | ❌ | ❌ |
| Resolution | 1K/2K/4K/Adaptive | 1K/2K/4K/Adaptive | 1K/2K/4K/Adaptive | 1K/2K/4K/Adaptive |
| Feature | v5.0 | v4.5 | v4.0 | v3.0 T2I | v3.0 I2I (Edit) |
|---------|------|------|------|----------|-----------------|
| Text-to-Image | ✅ | ✅ | ✅ | ✅ | ❌ |
| Image Editing | ❌ | ❌ | ❌ | ❌ | ✅ |
| Seed Control | ❌ | ❌ | ❌ | ✅ | ✅ |
| Guidance Scale | ❌ | ❌ | ❌ | ✅ (default 2.5) | ✅ (default 5.5) |
| Sequential Gen | ✅ | ✅ | ✅ | ❌ | ❌ |
| Streaming | ✅ | ✅ | ✅ | ❌ | ❌ |
| 3K Resolution | ✅ | ❌ | ❌ | ❌ | ❌ |
| Web Search | ✅ | ❌ | ❌ | ❌ | ❌ |
| Resolution | 1K/2K/3K/4K/Adaptive | 1K/2K/4K/Adaptive | 1K/2K/4K/Adaptive | 1K/2K/4K/Adaptive | 1K/2K/4K/Adaptive |
"""


Expand All @@ -81,6 +89,7 @@ async def seedream_list_sizes() -> str:
|------|-------------|----------|
| `1K` | ~1024px (default) | General use, fast generation |
| `2K` | ~2048px | Higher detail, print-ready |
| `3K` | ~3072px | Extra detail (v5.0 only) |
| `4K` | ~4096px | Maximum quality, large prints |
| `adaptive` | Auto-selected based on content | Let the model choose optimal size |

Expand Down