Teams building AI companions, creative editors, or interactive voice apps rarely stay on one model provider for long. Within weeks, a codebase ends up splitting chat completions across an OpenAI-compatible host, routing image edits to a separate diffusion endpoint with custom auth headers, polling a third service for text-to-speech, and maintaining three prepaid wallets with stranded balances.

Every extra provider multiplies failure points: mismatched error envelopes, inconsistent safety classifier refusals mid-session, and divergent retry logic across SDKs. Consolidating synchronous chat (silly-2.0), instruction-based image editing and character-locked stills (seedream-5.0-pro-spicy, qwen-image-2.1-spicy, qwen-image-edit-spicy, z-image-spicy), and expressive speech (siren-1.0-spicy) onto a single OpenAI-compatible and async task gateway removes vendor sprawl and settles every workload against one credit balance.

This migration walkthrough covers exact request shapes, OpenAI SDK diffs, CLI dry-run verification, and unit-cost budgeting on HotAPI, anchored to the API getting started guide and live pricing schedule.

What actually changes when you point the OpenAI SDK at HotAPI for Silly 2.0 chat?

Synchronous and SSE streaming chat completions require changing only baseURL, apiKey, and model to silly-2.0, because POST /v1/chat/completions emits standard OpenAI response objects, chat.completion.chunk stream frames, and tool_calls.

Built on GLM-5.3 open weights post-trained for roleplay, Silly 2.0 (chat completions endpoint spec) exposes a 74K+ token context window and keeps internal reasoning on a separate reasoning channel so planning notes never spill into visible character prose. Unlike image and video routes, chat is synchronous or SSE-streamed and does not accept Idempotency-Key or ?webhook=. Billing settles token by token at 9,000 credits ($9.00) per 1M input tokens and 30,000 credits ($30.00) per 1M output tokens (1,000 credits = $1.00 USD): the gateway holds an upper-bound reservation from max_tokens (default 4096) and refunds unused credits once token counts return.

For TypeScript apps using the Vercel AI SDK, pair @ai-sdk/openai-compatible with https://api.hotapi.ai/v1 rather than @ai-sdk/openai, because recent versions of @ai-sdk/openai target /v1/responses instead of /v1/chat/completions. You can generate SDK diffs with the OpenAI to HotAPI migrator or read the chat completions guide. Language-specific adapters live in the integrations hub, including the OpenAI SDK integration blueprint and Vercel AI SDK integration guide, and architectural tradeoffs are laid out in HotAPI vs Replicate and Fal.ai.

import OpenAI from "openai"; const client = new OpenAI({ apiKey: process.env.HOTAPI_KEY, baseURL: "https://api.hotapi.ai/v1", }); export async function streamCompanionReply(userMessage: string) { const stream = await client.chat.completions.create({ model: "silly-2.0", max_tokens: 600, temperature: 0.85, stream: true, messages: [ { role: "system", content: "You are Maya, a night-shift diner owner who remembers regulars. Keep replies grounded in physical scene details.", }, { role: "user", content: userMessage }, ], }); let reply = ""; for await (const chunk of stream) { const token = chunk.choices[0]?.delta?.content; if (token) { reply += token; process.stdout.write(token); } } return reply; } 

How do Seedream 5.0 Pro, Qwen Image 2.1, and Z-Image split editing vs generation workloads?

Route multi-image blending and Pro instruction edits to seedream-5.0-pro-spicy, single-source edits with up to two guide references to qwen-image-edit-spicy, multi-scene character lock to qwen-image-2.1-spicy, and high-volume seeded stills to z-image-spicy.

While chat stays synchronous on /v1/chat/completions, every image, image-edit, and speech model uses one async contract: POST returns 202 Accepted with a task id, and your worker retrieves assets via GET /v1/tasks/{id} or ?webhook=. That shared envelope means switching between an editorial blend, a wardrobe swap, and a character selfie never changes your queue or storage pipeline.

Model slug API endpoint Input & reference caps Output spec Rate (1,000 cr = $1) Primary engineering use case
silly-2.0 POST /v1/chat/completions System/user/tool messages (74K+ ctx) Sync JSON or SSE chunks 9,000 in / 30,000 out per 1M tok Persona-locked roleplay dialogue
seedream-5.0-pro-spicy POST /v1/seedream-5.0-pro-spicy/image-edit 1 HTTPS URL or array of 1-10 URLs + prompt size: "2K", 8 aspect ratios 120 cr / image ($0.12) Multi-image blending and Pro edits
qwen-image-2.1-spicy POST /v1/qwen-image-2.1-spicy prompt (<= 4000 chars) + up to 8 reference_image_urls 1K or 2K, n: 1-6 images 20 cr 1K ($0.02) / 40 cr 2K ($0.04) Same synthetic character across scenes
qwen-image-edit-spicy POST /v1/qwen-image-edit-spicy 1 image + up to 2 reference_images Matches primary image size, PNG 80 cr / image ($0.08) Prompt-driven edits on existing stills
z-image-spicy POST /v1/z-image-spicy prompt + optional seed 256-1536px (1024x1536 default), PNG 26 cr / image ($0.026) Fast seeded batch image generation
z-image-spicy-pro POST /v1/z-image-spicy-pro prompt + optional seed 256-2560px (1024x1024 default), PNG 30 cr / image ($0.03) High-DPI stills up to 2560px
siren-1.0-spicy POST /v1/siren-1.0-spicy text (1-600 chars) + optional voice 24 kHz mono WAV (~2 min max) 40 cr / audio min ($0.04, 3s min) Expressive character voice synthesis

Watch three schema details when migrating workers. First, /v1/seedream-5.0-pro-spicy/image-edit accepts either one HTTPS image string or an array of 1 to 10 HTTPS URLs for blending, and its live OpenAPI contract restricts size to "2K" (aspect_ratio optional). Second, passing reference_image_urls to qwen-image-2.1-spicy sets 2K 1:1 output to approximately 1536x1536 rather than 2048x2048, and every reference image must stay within an 8:1 aspect ratio. Third, qwen-image-edit-spicy preserves the composition and dimensions of the primary image URL while reading reference_images in array order. Compare quality tradeoffs in the Seedream 5.0 Pro vs Qwen Image 2.1 benchmark, or inspect individual model contracts for Seedream 5.0 Pro image-edit, Qwen Image 2.1, Qwen Image Edit, Z-Image, Z-Image Pro, and the full model reference index.

import os import time import httpx HOTAPI_KEY = os.environ["HOTAPI_KEY"] TERMINAL = {"succeeded", "failed", "cancelled"} def blend_with_seedream_pro( image_urls: list[str], instruction: str, idempotency_key: str, ) -> list[str]: with httpx.Client( base_url="https://api.hotapi.ai", headers={"Authorization": f"Bearer {HOTAPI_KEY}"}, timeout=30.0, ) as client: submit = client.post( "/v1/seedream-5.0-pro-spicy/image-edit", headers={"Idempotency-Key": idempotency_key}, json={ "image": image_urls, "prompt": instruction, "size": "2K", "aspect_ratio": "3:4", }, ) submit.raise_for_status() task_id = submit.json()["id"] deadline = time.monotonic() + 180.0 while time.monotonic() < deadline: poll = client.get(f"/v1/tasks/{task_id}") poll.raise_for_status() task = poll.json() if task["status"] in TERMINAL: if task["status"] != "succeeded": raise RuntimeError(f"Edit failed ({task_id}): {task.get('error')}") return [asset["url"] for asset in task["output"]["assets"]] time.sleep(2.0) raise TimeoutError(f"Timed out waiting for image edit task {task_id}") 

Why does Siren 1.0 charge per audio second instead of per input character?

Billing POST /v1/siren-1.0-spicy by generated WAV duration (40 credits, or $0.04, per audio minute with a 3-second minimum) ensures slower-speaking languages and deliberate pauses never overcharge callers relative to output length.

Because 100 characters take roughly 12 seconds to speak in English versus 20 seconds in Chinese, per-character TTS billing penalizes compact scripts. On Siren 1.0 Spicy, breaths, hesitations, and tone shifts come from natural punctuation and performance phrasing inside the 1-to-600-character text field plus an optional voice preset such as "Kore", without inline SSML tags. The gateway charges an initial reservation at submission and refunds the difference down to the exact length of the 24 kHz mono WAV asset once generation completes.

Per-line speech synthesis fits directly beside streaming chat: split dialogue by turn or scene beat so a single retried inflection re-bills only a few seconds instead of a whole paragraph, as structured in the Siren 1.0 Spicy speech spec and the multimodal AI companion architecture playbook.

curl -sS -X POST https://api.hotapi.ai/v1/siren-1.0-spicy \ -H "Authorization: Bearer $HOTAPI_KEY" \ -H "Idempotency-Key: line_maya_014" \ -H "Content-Type: application/json" \ -d '{ "text": "Wait by the side door for ten seconds... the streetlamp out front is flickering again.", "voice": "Kore" }' 

How do you validate schemas and run dry checks with hotapi-cli before writing backend code?

Installing hotapi-cli (Node.js 22+) lets you inspect live model schemas with hotapi model schema <slug> --refresh and verify local payload parsing with --dry-run --json before spending a credit or editing application code.

Notice one environment variable boundary before running commands: HTTP integrations commonly read HOTAPI_KEY, whereas the CLI reads HOTAPI_API_KEY (or stores a key via hotapi auth login --key-stdin in ~/.hotapi/config.json with mode 600). Non-TTY stdout always emits one machine-readable JSON object with predictable exit codes (0 success, 1 bad input, 2 invalid auth, 3 API or task failure, 4 missing task or schema, 5 timeout, 6 network failure, 130 local interrupt without cancelling the remote task). Paid POST requests never auto-retry inside the CLI; instead, each async submission records _cli.idempotency_key so recovery scripts can inspect or replay safely. See the HotAPI CLI overview and CLI documentation for the full flag reference.

# CLI expects HOTAPI_API_KEY (separate from HTTP examples using HOTAPI_KEY) export HOTAPI_API_KEY="hk_live_..." hotapi auth status --verify # Pull the live input schema before coding request structs hotapi model list --modal image --output json | jq '.data[] | .id' hotapi model schema qwen-image-edit-spicy --refresh # Verify local parsing with zero network calls and zero credit charges hotapi run qwen-image-edit-spicy \ image=@./avatar.png \ prompt="change jacket to matte black leather under cool rainlight" \ --dry-run --json # Submit async, then wait and download output files to a clean directory TASK_ID=$(hotapi run z-image-spicy \ prompt="cinematic neon alleyway, wet pavement reflections" \ width=1024 height=1024 --async --json | jq -r '.id') hotapi task wait "$TASK_ID" --download --out-dir ./outputs --json 

How do you forecast monthly spend across chat, images, and voice on one credit wallet?

Forecast monthly spend across one wallet by summing per-token chat charges, flat per-image fees, and exact-second voice durations against the fixed 1,000 credits = $1.00 USD exchange rate. Purchased credits never expire, so every modality draws down the same balance without separate vendor minimums.

Consider a companion app running 2,000 active sessions per day totaling 1.5M Silly 2.0 input tokens (13,500 credits), 400K output tokens (12,000 credits), 500 Qwen Image 2.1 1K selfies (10,000 credits), 100 qwen-image-edit-spicy wardrobe edits (8,000 credits), and 60 minutes of Siren 1.0 voice replies (2,400 credits). Total daily spend equals 45,900 credits, or $45.90 across all four capabilities with zero idle GPU retainers. You can model your own monthly traffic mix directly in the AI API pricing calculator alongside the rest of the developer tools hub.

When an organization balance runs low, requests fail fast before inference with 402 insufficient_credits. Because card payments and auto-top-up are not supported on self-serve BoomFi crypto top-ups ($20 to $10,000), production workers should catch 402 to alert operators and reconcile daily spend via GET /v1/usage?from=YYYY-MM-DD&to=YYYY-MM-DD as described in the credits and billing guide.