HiAPI
  • Models
  • Pricing
Search

Search HiAPI models, tools, and resources.

  • Models
  • Pricing
HiAPI

One API, All AI Models

Generate images, video, and audio with leading models through one production-ready API.

Get a free API key

AI Image API

  • All image models
  • GPT Image 2.5 Flare
  • GPT Image 2.5 Sunburst
  • GPT Image 2
  • Nano Banana 2
  • Seedream 5.0 Pro
  • Qwen Image 2.0 Pro
  • FLUX 1.1 Pro

AI Video API

  • All video models
  • Seedance 2.5
  • FLUX.3 Video
  • Seedance 2.0
  • Veo 3.1
  • Kling 3.0

AI Audio API

  • All audio models
  • MiniMax Music 2.6
  • MiniMax Music 1.5
  • ElevenLabs v3
  • Text to music
  • Text to speech

Product

  • Model marketplace
  • Playground
  • Pricing
  • Image API Cost Calculator
  • Free GPT Image 2 Generator
  • Free Background Remover
  • Free Nano Banana Image Generator
  • Outfit Preview
  • Product Photo Lab

Developers

  • Agent setup
  • Documentation
  • API Reference
  • Agent Skills
  • LLM integration index
  • Blog

Company

  • About
  • Contact support
  • Terms of Service
  • Privacy Policy

© 2026 hiapi. All rights reserved.

Open source on GitHubPython SDK on PyPI
  • What you'll build, and what you need first
  • The pricing shape you're optimizing for
  • Minimal runnable example
  • Production-grade patterns
  • Related hiapi resources
  • FAQ
TutorialOct 8, 2026

Seedream API Cost Optimization: How to Cut Image Generation Costs on hiapi

hiapiseedreamcost-optimizationapi-tutorialimage-generation

Latest models

Explore models

Contents
  • What you'll build, and what you need first
  • The pricing shape you're optimizing for
  • Minimal runnable example
  • Production-grade patterns
  • Related hiapi resources
  • FAQ

Generate it with HiAPI

Choose a model, enter your prompt, and see the result.

HiAPI Blog

Related articles

HiAPI

Generate it with HiAPI

Seedream ships on hiapi as four distinct tiers — seedream-5.0-flash, seedream-5.0-lite, seedream-5.0-pro, and legacy seedream-4.5 — and each one bills differently. Pick the wrong tier or the wrong resolution for the job and you can pay 2-4x more per image for no visible quality gain. This guide shows the actual pricing shape of each tier and a working code pattern for calling the cheapest model that still meets your bar.

What you'll build, and what you need first

You'll build a small Python client that creates a Seedream image task through hiapi's unified task API, waits for the result, and picks resolution/model combinations deliberately instead of defaulting to whatever a tutorial copy-pasted. Before anything else, grab an API key from your hiapi dashboard — every request below sends it as Authorization: Bearer sk-....

The pricing shape you're optimizing for

Current per-image pricing (always confirm against the live pricing page before you ship, since rates do change):

  • seedream-5.0-flash — flat $0.025/image, same price for text-to-image and image-to-image. Cheapest tier on the platform; best for drafts, thumbnails, and anything you'll regenerate several times before picking a winner.
  • seedream-5.0-lite — flat $0.035/image, and critically, the same price whether you render at 2K or 4K. There's no cost reason to ever request 2K on this tier — 4K is a free upgrade.
  • seedream-4.5 (legacy) — flat $0.045/image for both endpoints.
  • seedream-5.0-pro — resolution-tiered, not flat: text-to-image is $0.05 at 1K and $0.10 at 2K; image-to-image is $0.06 at 1K and $0.10 at 2K. On this tier, resolution is where your budget actually goes — a 1K draft costs roughly half of a 2K final render.

That asymmetry is the whole optimization: lite rewards requesting higher resolution (it's free), pro punishes it (it roughly doubles cost). Treat them differently in your calling code instead of hard-coding one resolution everywhere.

Minimal runnable example

Every Seedream call goes through the same async task endpoints: create with POST /v1/tasks, then either poll GET /v1/tasks/{taskId} or receive a webhook callback. Model ids are bare — no leading models/ or vendor prefix.

import os
import time
import requests

API_KEY = os.environ["HIAPI_API_KEY"]  # starts with sk-
BASE_URL = "https://api.hiapi.ai/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}


def create_task(model: str, input_payload: dict) -> str:
    resp = requests.post(f"{BASE_URL}/tasks", headers=HEADERS,
                          json={"model": model, "input": input_payload}, timeout=30)
    resp.raise_for_status()
    return resp.json()["data"]["taskId"]


def wait_task(task_id: str, interval: float = 3.0, timeout: float = 180.0) -> dict:
    deadline = time.time() + timeout
    while time.time() < deadline:
        resp = requests.get(f"{BASE_URL}/tasks/{task_id}", headers=HEADERS, timeout=30)
        resp.raise_for_status()
        data = resp.json()["data"]
        if data["status"] == "success":
            return data
        if data["status"] == "fail":
            raise RuntimeError(data["error"])
        time.sleep(interval)
    raise TimeoutError(f"task {task_id} did not finish within {timeout}s")


# seedream-5.0-lite: 4K costs the same $0.035 as 2K, so always ask for 4K here.
task_id = create_task(
    "seedream-5.0-lite/text-to-image",
    {"prompt": "a minimalist product photo of a ceramic mug on a wooden table", "resolution": "4K"},
)
result = wait_task(task_id)
image_url = result["output"][0]["url"]
print(image_url)

resolution on seedream-5.0-lite only accepts 2K or 4K (no 1K). seedream-5.0-pro instead accepts 1K/2K and additionally requires aspect_ratio (one of 1:1, 4:3, 3:4, 16:9, 9:16, 2:3, 3:2, 21:9) — each Seedream tier has a slightly different input schema, so don't assume one model's accepted fields carry over to another.

Production-grade patterns

Pick the tier programmatically, not by habit. Keep a small cost table next to your call site and route by budget/quality need instead of hard-coding one model everywhere — treat the numbers as a cache of the pricing page, not the source of truth:

SEEDREAM_COST_USD = {
    ("seedream-5.0-flash", None): 0.025,
    ("seedream-5.0-lite", "2K"): 0.035,
    ("seedream-5.0-lite", "4K"): 0.035,   # same price — always prefer 4K
    ("seedream-5.0-pro", "1K"): 0.05,      # text-to-image; i2i 1K is $0.06
    ("seedream-5.0-pro", "2K"): 0.10,
}

def pick_model_for_draft_vs_final(is_final: bool) -> tuple[str, dict]:
    if not is_final:
        return "seedream-5.0-flash", {}  # $0.025, iterate freely
    return "seedream-5.0-pro", {"resolution": "2K"}  # $0.10, one shot at the end

Prefer callbacks to tight polling. Add callback to the create request instead of looping wait_task every few seconds in high-volume pipelines:

task_id_resp = requests.post(
    f"{BASE_URL}/tasks", headers=HEADERS,
    json={
        "model": "seedream-5.0-lite/text-to-image",
        "input": {"prompt": "...", "resolution": "4K"},
        "callback": {"url": "https://yourapp.example.com/webhooks/hiapi", "when": "final"},
    },
    timeout=30,
)

Your webhook handler receives one POST when the task reaches a terminal state (success or fail) instead of your worker burning requests in a poll loop. Polling is still the simpler option if you can't expose a public HTTPS endpoint (local dev, internal tools) — pick callbacks once you're running this at real volume.

Dedupe before you create a task, not after. The task API bills on creation, so a retried request (timeout, crashed worker, redeployed queue consumer) that resubmits the same job bills twice. Before calling create_task, check your own store for an existing task keyed by (model, input_hash) and skip creation if one's already in flight or already succeeded — hiapi's task endpoint has no built-in dedupe, so this has to live in your code.

Handle auth failures explicitly. An invalid or revoked key returns HTTP 401 with a structured body, not a generic error page:

{"error": {"code": "permission_denied", "type": "hiapi_error", "request_id": "..."}}

Check for error.code == "permission_denied" specifically so a bad key fails fast instead of retrying into a timeout.

Related hiapi resources

  • Pricing — current per-model rates; treat any number in this article as a snapshot, not a guarantee.
  • API keys dashboard — create and rotate keys.
  • Seedream 5.0 Lite — Text-to-Image and Image-to-Image model pages.
  • Seedream 5.0 Pro — Text-to-Image and Image-to-Image model pages.
  • Seedream 5.0 Flash model page.
  • Async task API reference — full create/poll/callback contract.
  • Authentication docs — key format and header requirements.

FAQ

Which Seedream model is cheapest for quick drafts or icons? seedream-5.0-flash at a flat $0.025/image — the cheapest tier on the platform, same price for text-to-image and image-to-image.

Does asking for 4K instead of 2K cost more on Seedream 5.0 Lite? No. seedream-5.0-lite is a flat $0.035/image regardless of whether resolution is 2K or 4K, so request 4K by default on this tier.

How much does Seedream 5.0 Pro cost per image? It's resolution-tiered: text-to-image is $0.05 at 1K and $0.10 at 2K; image-to-image is $0.06 at 1K and $0.10 at 2K. Unlike lite, resolution genuinely changes your bill here.

How do I avoid getting billed twice if my job retries? The task API has no server-side idempotency key, so dedupe client-side: store a key for (model, input_hash) before calling create_task and skip creation if that key is already in flight or already succeeded.

Should I poll or use a webhook callback? Poll GET /v1/tasks/{taskId} if you can't expose a public HTTPS endpoint (local dev, scripts). Switch to callback.url + when: "final" once you're running real volume — it replaces a poll loop with a single push notification per task.

What does an invalid API key return? HTTP 401 with {"error": {"code": "permission_denied", "type": "hiapi_error", "request_id": "..."}}. Check for that error code explicitly rather than retrying a bad key into a timeout.

Can I use these prices without an API key first? No — every /v1/tasks call requires a valid Authorization: Bearer sk-... header from a real key created in your dashboard; there's no keyless or trial-without-signup path for production generation.

Latest models

View all models
  • GPT Image 2.5 Flare50% offFrom $0.025/image
  • GPT Image 2.5 Sunburst50% offFrom $0.025/image
  • GPT Image 2From $0.030/image
  • Nano Banana 250% offFrom $0.018/image

Explore models

TextImageVideoAudio
Back to blog
GPT Image 2.5 Flare50% offFrom $0.050/image$0.025/image
GPT Image 2.5 Sunburst50% offFrom $0.050/image$0.025/image
GPT Image 2From $0.030/image
Nano Banana 250% offFrom $0.036/image$0.018/image
View all models
TextChat and reasoning
ImageGenerate and edit
VideoText and image to video
AudioSpeech and music
Start generating
View model pricing
View all articles
HiAPI 402 Error: How to Fix 'Insufficient Balance'

HiAPI 402 Error: How to Fix 'Insufficient Balance'

Seedance 2.0 Ext First-Frame Video Prompts: Anchor vs Interpolation

Seedance 2.0 Ext First-Frame Video Prompts: Anchor vs Interpolation

Seedance 2.0 Realistic Prompt: Making AI Video Look Like Real Phone Footage

Seedance 2.0 Realistic Prompt: Making AI Video Look Like Real Phone Footage

HiAPI Task Timeout and 504 Errors: How to Fix Them

HiAPI Task Timeout and 504 Errors: How to Fix Them

Building Multi-Model AI Apps with a Single Unified API on hiapi

Building Multi-Model AI Apps with a Single Unified API on hiapi

Seedance 2.0 Ext 2D Sticker Composite Prompt: Full Breakdown

Seedance 2.0 Ext 2D Sticker Composite Prompt: Full Breakdown

Start generating