MCPInstall

gemini-to-seedream-migration

Migrate AI image generation from Google Gemini 2.5 Flash to BytePlus SeeDream v4.5. Use when: (1) User wants to switch from Gemini to SeeDream/BytePlus for image generation, (2) User asks about migrating image generation APIs or replacing Gemini with BytePlus, (3) User needs cost optimization or better image quality for AI-generated images, (4) User mentions SeeDream, BytePlus, or wants SDK-to-REST API migration for image generation

Installs
42
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/julianromli/ai-skills --skill gemini-to-seedream-migration
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads gemini-to-seedream-migration automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Gemini to SeeDream v4.5 Migration

Migrate AI image generation from Google Gemini 2.5 Flash Image to BytePlus SeeDream v4.5 with this proven, production-ready workflow.

Quick Start

Migration Overview:

  • Replace Gemini SDK with BytePlus REST API
  • Update environment variables and validation
  • Migrate API routes to new client
  • Test and validate changes
  • Update documentation

Benefits:

  • Higher resolution support (up to 4K vs 2K)
  • Better control over image dimensions and generation
  • Built-in prompt optimization for quality improvement
  • Potentially lower costs (check BytePlus pricing)
  • Broader format support (adds BMP, TIFF, GIF)

Prerequisites:

Time Estimate: 3-4 hours for complete migration


Core Migration Workflow

Phase 1: Environment Setup

Replace Gemini environment variables with BytePlus configuration.

Step 1.1: Update .env.example

Find and remove Gemini configuration:

# REMOVE
GEMINI_API_KEY=your_google_ai_api_key_here

Add BytePlus configuration:

# ADD
BYTEPLUS_API_KEY=your_byteplus_api_key_here

Step 1.2: Update Environment Validator

If you have environment validation (recommended), update it to check for BYTEPLUS_API_KEY instead of GEMINI_API_KEY.

Example changes:

// OLD
{
  name: 'GEMINI_API_KEY',
  required: true,
  description: 'Google AI API key for image generation',
  setupUrl: 'https://aistudio.google.com/app/apikey',
}

// NEW
{
  name: 'BYTEPLUS_API_KEY',
  required: true,
  description: 'BytePlus SeeDream API key for image generation',
  setupUrl: 'https://console.byteplus.com/ark/region:ark+ap-southeast-1/apiKey',
}

Step 1.3: Add API Key to Local Environment

Add to your .env.local:

BYTEPLUS_API_KEY=your_actual_byteplus_api_key

Step 1.4: Verify Environment

Test that validation detects the new key correctly:

npm run validate  # or your validation command

Phase 2: Create BytePlus Client

Create a reusable REST API client for BytePlus SeeDream v4.5.

Step 2.1: Create Client File

Create lib/byteplus-client.ts (or appropriate path for your project).

See references/client-template.ts for a fully commented, production-ready template.

Key implementation points:

  • Use native fetch API (no SDK required)
  • Convert base64 to data URI format: data:image/png;base64,${base64String}
  • Add comprehensive error handling for all HTTP status codes
  • Validate API key before making requests
  • Include verbose logging for debugging
  • Return consistent interface matching your app's expectations

Step 2.2: Configure Model Parameters

Choose appropriate parameters for your use case:

Model ID: seedream-4-5-251128 (latest as of Dec 2025)

Size options:

  • Fixed pixels: 2048x2560 (portrait), 2560x2048 (landscape), 2048x2048 (square)
  • Semantic: 2K, 4K (model determines exact dimensions)

Prompt optimization:

  • mode: "standard" - Higher quality, slower (~45-60s)
  • mode: "fast" - Good quality, faster (~15-30s)

Other settings:

  • sequential_image_generation: "disabled" - Single image output
  • watermark: false - No watermark
  • response_format: "b64_json" - Base64 response

Step 2.3: Test Client

Create a simple test to verify the client works:

const result = await generateImageWithByteplus({
  prompt: "A simple test image of a red circle",
  images: [] // or test images
})

console.log(result.imageUrl ? "Success!" : result.error)

Phase 3: Migrate API Routes

Replace Gemini SDK calls with BytePlus client in all API routes.

Step 3.1: Remove Gemini Imports

In each API route file:

// REMOVE
import { GoogleGenAI } from "@google/genai"

Add BytePlus import:

// ADD
import { generateImageWithByteplus } from "@/lib/byteplus-client"

Step 3.2: Replace Generation Calls

Before (Gemini SDK):

const genAI = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY! })

const result = await genAI.models.generateContent({
  model: "gemini-2.5-flash-image",
  contents: [{
    role: "user",
    parts: [
      { text: prompt },
      { inlineData: { mimeType: "image/png", data: base64Image1 } },
      { inlineData: { mimeType: "image/jpeg", data: base64Image2 } }
    ]
  }],
  config: {
    responseModalities: ["IMAGE"],
    imageConfig: { aspectRatio: "4:5" }
  }
})

// Extract image from candidates
const imagePart = result.candidates[0].content.parts.find(p => p.inlineData)
const base64Image = `data:${imagePart.inlineData.mimeType};base64,${imagePart.inlineData.data}`

After (BytePlus REST):

const result = await generateImageWithByteplus({
  prompt: prompt,
  images: [
    { data: base64Image1, mimeType: "image/png" },
    { data: base64Image2, mimeType: "image/jpeg" }
  ]
})

if (result.error) {
  return NextResponse.json({ error: result.error }, { status: 500 })
}

// Image already in data URI format
const base64Image = result.imageUrl

Step 3.3: Handle Response Differences

BytePlus doesn't return text alongside images. If your frontend expects both:

return NextResponse.json({
  imageUrl: result.imageUrl,
  text: "", // BytePlus doesn't generate text
  usage: result.usage
})

Step 3.4: Update Logging

Replace Gemini-specific log messages:

// OLD
console.log("[v0] Gemini API key available:", !!process.env.GEMINI_API_KEY)
console.log("[v0] Calling Gemini API...")

// NEW
console.log("[v0] BytePlus API key available:", !!process.env.BYTEPLUS_API_KEY)
console.log("[v0] Calling BytePlus SeeDream v4.5 API...")

Phase 4: Dependency Cleanup

Remove Gemini SDK from project dependencies.

Step 4.1: Uninstall Gemini SDK

npm uninstall @google/genai

This automatically updates package.json and package-lock.json.

Step 4.2: Verify Removal

Check that Gemini is no longer referenced:

grep -i "genai\|gemini" package.json

Expected: No matches (empty output).

Step 4.3: Rebuild

npm install
npx tsc --noEmit  # Verify no type errors

Phase 5: Testing & Validation

See references/testing-checklist.md for comprehensive testing guide.

Quick validation:

  1. Environment validation passes: npm run validate
  2. TypeScript compiles: npx tsc --noEmit
  3. Linting passes: npm run lint
  4. Build succeeds: npm run build
  5. Manual API test generates images correctly

Test scenarios:

  • Happy path: Valid images + prompt → generates image
  • Invalid API key → Returns 401 with clear message
  • Missing images → Returns 400 error
  • Rate limit → Returns 429 with retry message
  • Service error → Returns 500 with retry message

Phase 6: Documentation Updates

Update all documentation to reflect BytePlus instead of Gemini.

Files to update:

  • README.md - Replace "Gemini 2.5 Flash" with "BytePlus SeeDream v4.5"
  • SETUP.md - Update API key setup instructions
  • ARCHITECTURE.md - Update AI integration section
  • Any troubleshooting guides - Update error codes and debugging steps

Search for remaining references:

grep -ri "gemini\|google ai" *.md docs/*.md

Key Differences: Gemini vs BytePlus

See references/api-comparison.md for detailed parameter mapping.

Quick comparison:

AspectGemini 2.5 FlashBytePlus SeeDream v4.5
IntegrationSDK (@google/genai)REST API (native fetch)
AuthAPI key in constructorBearer token in header
Image inputBase64 in inlineDataData URI in image array
ResolutionAspect ratio (4:5)Exact pixels (2048x2560)
Responsecandidates[].content.parts[]data[0].b64_json
Text outputSupportedNot supported

Common Pitfalls

See references/troubleshooting.md for detailed solutions.

Common mistakes:

  1. Forgetting data URI format - BytePlus requires data:image/png;base64,... not plain base64
  2. Wrong model ID - Use seedream-4-5-251128 not seedream-4.5
  3. Missing error handling - Handle all HTTP status codes (400, 401, 429, 500)
  4. Not validating API key - Check key exists before making requests
  5. Incorrect image format - Ensure images are in supported formats (PNG/JPEG/WEBP)

Quick Reference

Gemini SDK Pattern

import { GoogleGenAI } from "@google/genai"

const genAI = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY! })

const result = await genAI.models.generateContent({
  model: "gemini-2.5-flash-image",
  contents: [{
    role: "user",
    parts: [
      { text: prompt },
      { inlineData: { mimeType, data: base64String } }
    ]
  }],
  config: {
    responseModalities: ["IMAGE"],
    imageConfig: { aspectRatio: "4:5" }
  }
})

BytePlus REST Pattern

import { generateImageWithByteplus } from "@/lib/byteplus-client"

const result = await generateImageWithByteplus({
  prompt: prompt,
  images: [{ data: base64String, mimeType: "image/png" }]
})

if (result.error) {
  // Handle error
}

Error Handling

See references/error-handling.md for comprehensive guide.

HTTP Status Codes:

  • 400 - Invalid request (check image format, size, aspect ratio)
  • 401 - Authentication failed (invalid API key)
  • 429 - Rate limit exceeded (implement backoff)
  • 500 - Service error (retry with exponential backoff)

Example error handler:

if (!response.ok) {
  switch (response.status) {
    case 400:
      return { error: "Invalid image or prompt" }
    case 401:
      return { error: "BytePlus API authentication failed" }
    case 429:
      return { error: "Rate limit exceeded, please try again later" }
    case 500:
      return { error: "BytePlus service error, please retry" }
    default:
      return { error: "Failed to generate image" }
  }
}

Success Criteria

Migration complete when:

  • ✅ All API routes use BytePlus instead of Gemini
  • ✅ Environment validation passes
  • ✅ TypeScript compilation passes (npx tsc --noEmit)
  • ✅ Linting passes (npm run lint)
  • ✅ Build succeeds
  • ✅ Generated images meet quality expectations
  • ✅ All error scenarios handled gracefully
  • ✅ Documentation updated
  • ✅ Production deployment stable

Additional Resources


Troubleshooting

For common issues and solutions, see references/troubleshooting.md.

For API parameter details, see references/api-comparison.md.

For comprehensive testing checklist, see references/testing-checklist.md.

FAQ

What does the gemini-to-seedream-migration skill do?

Migrate AI image generation from Google Gemini 2.5 Flash to BytePlus SeeDream v4.5. Use when: (1) User wants to switch from Gemini to SeeDream/BytePlus for image generation, (2) User asks about migrating image generation APIs or replacing Gemini with BytePlus, (3) User needs cost optimization or better image quality for AI-generated images, (4) User mentions SeeDream, BytePlus, or wants SDK-to-REST API migration for image generation

How do I install gemini-to-seedream-migration?

Run npx skills add https://github.com/julianromli/ai-skills --skill gemini-to-seedream-migration in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/gemini-to-seedream-migration/ (personal) or .claude/skills/gemini-to-seedream-migration/ (project).

Which AI agents can use gemini-to-seedream-migration?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is gemini-to-seedream-migration safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains gemini-to-seedream-migration?

It is published by julianromli in julianromli/ai-skills. It has 42 recorded installs.

More from julianromli/ai-skills

View all →

clone-website

julianromli/ai-skills

Reverse-engineer and clone one or more websites in one shot — extracts assets, CSS, and content section-by-section and proactively dispatches parallel builder agents in worktrees as it goes. Use this whenever the user wants to clone, replicate, rebuild, reverse-engineer, or copy any website. Also triggers on phrases like "make a copy of this site", "rebuild this page", "pixel-perfect clone". Provide one or more target URLs as arguments.

Marketing & SEO2.1K installs

frontend-ui-animator

julianromli/ai-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design342 installs

make-interfaces-feel-better

julianromli/ai-skills

Open the skill to read its SKILL.md instructions.

184 installs

frontend-design

julianromli/ai-skills

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

Frontend & Design177 installs

browser

julianromli/ai-skills

Minimal Chrome DevTools Protocol tools for browser automation and scraping. Use when you need to start Chrome, navigate pages, execute JavaScript, take screenshots, or interactively pick DOM elements.

ui-ux-pro-max

julianromli/ai-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design121 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs