mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-18 05:02:15 +03:00
* fix(ci): clear base-reds on release/v3.8.50 (round 3) - CHANGELOG.md: restore the top [Unreleased] section dropped by the #10189 reconcile (docs-sync gate: first section must be Unreleased) - env-doc-sync: document CONDUCTOR_ORCHESTRATOR_TOKEN + CONDUCTOR_SPOKESPERSON_URL in .env.example/ENVIRONMENT.md; allowlist the CI-only GITHUB_STEP_SUMMARY and TS7_BASE_REF (ts7 ratchet signals); drop a stray merge artifact line - providers: restore the audited chatanywhere metadata entry that base-reds round 2 dropped together with its duplicate — the provider was half-wired (registry+endpoint without APIKEY metadata), which is what the wave3 test catches; re-pin providers-constants-split at the measured 228 - docs counts: 338 -> 339 (today's +2 void-ai/helixmind, -1 Puter) via gen:provider-reference + README/AGENTS/llm.txt/package.json/diagrams/i18n mirrors - file-size ratchet: annotated rebaseline for the two pre-existing drifts (ModelSelectModal 1138, gateways 1250) following the 2026-08-11 precedent Refs #9985 * fix(ci): base-reds round 3b — stale sibling tests + mode-pack weight contract - check-docs-counts-sync.test.ts: drop the imports/subtests of the four helpers #10196 removed from the gate script (readMcpFactsFromSource, listLocalizedDocs, makeRequiredCountsValidator, checkFreeTierInventory) — the new-API tests that #10196 added stay; the file now loads again under the node runner - quota-connection-recovery.test.ts: convert from vitest APIs to node:test — the file lives in tests/unit/*.test.ts (node-runner glob) and the vitest runtime crashes when imported outside vitest, killing the whole shard entry - modePacks.ts: re-normalize all six mode packs to sum 1.0 — #8940 added sessionAvailability: 0.05 to every pack without rebalancing (1.05 total); ratios preserved exactly (÷1.05), so post-normalizeScoringWeights behavior is unchanged; restores the declared sum-to-1.0 contract the 4235 test pins Refs #9985 * fix(ci): base-reds round 3c — vitest siblings, weights default, secrets FP, mutation tap - DistributeProxiesButton.test.tsx: wrap renders in NextIntlClientProvider — #9245 localized the component (useTranslations) and left the test without the intl context, failing all 14 cases - scoring.ts: re-normalize DEFAULT_WEIGHTS to sum 1.0 (same #8940 class as the mode packs — sessionAvailability added without rebalancing; ratios preserved) - .gitleaks.toml: generalize the kimi sponsor-banner localStorage-key allowlist to -v\d+ — #10200 bumped v1→v2 and the stale regex regressed the secrets ratchet with a false positive - stryker.conf.json: register 6 covering unit tests in tap.testFiles (4 modules) so their mutant kills count — unblocks check:mutation-test-coverage --strict Refs #9985 * fix(ci): base-reds round 3d — inspector factor gap, stale registry/gap tests, i18n key sync - comboScoringInspector: add cacheAffinity/sessionAvailability/connectionDensity to FACTOR_KEYS + the factor-key type — calculateScore() weighs them but the breakdown omitted them, so the explained contributions never summed to the reported score (inspector bug, red on the pure tip) - combo-scoring-inspector.test: make the explicit-weights override sum-neutral (±0.05 shift) so it stays valid for any DEFAULT_WEIGHTS values — the hardcoded override only summed to 1.0 against the pre-#8940 defaults, which is also why explicit weights silently fell back to 'default' on the tip - unorouter-registry.test: align to the canonical .com host (api.unorouter.ai 301-redirects there, verified live) and to wave4's live model discovery (passthrough, no static seed) — the .ai/auto-model expectations were stale - check-migration-numbering.test: 147 left KNOWN_GAPS when 147_api_keys_model_access_mode.sql landed — assert absent (same as 143) - i18n: sync-ui pass — 35,914 missing UI keys stamped as __MISSING__ placeholders across 42 locales (mechanical; greens the pt-BR key-presence integrity test; coverage pct unchanged by design — translation is a separate workstream) Refs #9985 * fix(ci): base-reds round 3e — 2 real defects + 14 stale sibling tests (waves A-E) Real defects fixed: - src/lib/db/apiKeys.ts: #9313's empty-allowlist early return bypassed the group permission check, silently disabling group deny rules (#8817) for every key without a per-key allowlist; fall-through restored, restricted+[] deny-all kept - open-sse/utils/proxyFetch.ts: #10032 re-appended the raw transport error to the propagated message, reintroducing the proxy user:password leak #9837 closed; new redactProxyDetailsInMessage() keeps the reason, redacts URL/credentials - .github/workflows/quality.yml: #10134 added the TS7 ratchet as a separate blocking step AFTER the aggregated gates — the exact #8542 masking mechanism; folded into the non-fail-fast loop (still blocking, still PR-only) ⚠️ CI edit, gate-strengthening — explicit owner sign-off requested on the PR - src/i18n/messages/ko.json: 3 machine-mistranslation regressions caught by the #8244 glossary checker (장애인→비활성화됨, 양말5://→socks5://, 비클로드→Claude가 아닌) Stale sibling tests aligned to deliberately-moved contracts (each cites its mover): request-log-detail-layout + -stream (#9245 intl provider), repro-8542 pin update, quality-rail-gate-membership (#10134 shape), agentSkills-routes 45→46 (#9058), cloudflare-ai-catalog-8717 (#8804 supersedes #8808), executor-xai (#9994), vision-bridge-claude-wire (#9463 minimax→openai), sse-auth forced-pin (#8893), tls-proxy-context (strengthened leak guards), rate-limit-local-error-classification (#9164/#9342), minimax-thinking-signature (#9463), codebuddy-cn (#9723 +1 test), github-copilot-custom-model (#9050), providers-g4f-batch3 (#9584), synced-capability-warmup (#9199, stricter), sidebar-tools-group (#8221), oauth-modal-grok-cli-paste (#9245); agentSkills/catalog.ts comment 45→46; file-size rebaseline for proxyFetch (+19, annotated) Refs #9985 * fix(ci): base-reds round 3f — waves F-J: 9 more real defects + stale sibling sweep Real production defects fixed (all red on the pure tip, each with its origin): - routeGuard.ts: #8949 accidentally DELETED the /api/providers/[id]/login local-only pattern — the route spawns a browser, so the loopback gate for a process-spawning route was gone (Hard Rules #15/#17); restored (314 guard tests green) - agentSkills generator: #9058's category dispatch gave the config category an empty body, wiping skills/config-codex-cli/SKILL.md at the #10131 sync; fixed + SKILL.md regenerated via the official generator - imageRegistry: #9982 broke same-provider bare aliasing (antigravity preview id sent upstream unresolved); new resolveSameProviderBareAlias() keeps the fal cross-provider fix intact - imageRegistry: #9982's prefix strip handed the bare nano-banana ids to fal-ai, violating the pinned 2026-07-31 operator decision (adobe-firefly owns them); fal entries made prefix-only (dispatch already re-prefixes) - mediaGeneration/fal.ts: the missing-credential 401 guard was lost when #10198 deleted the superseded falHandler — tests were hitting the live network - bottleneckPatch/rateLimitManager: #9041's merge clobbered #9604, resurrecting the Bottleneck v2.19.5 heartbeat bug (reservoir never refills); patched the library defect at the root and re-aligned chat-rate-limit-body-lock to the working reservoir contract - processSupervisor.mjs: #9761 regressed the Node spawn to bare "node" (the #9156 launchd bug) and dropped #9209's ipv4first args; both restored - openai-responses/pureHelpers: #9423's Agent null-sentinel was unreachable on the schemaless JSON-string path; gate extended - i18n en.json: #8222's regen reverted the #9976 unclosed-tag fix and #8559's combo-cooldown copy; #9038 shipped 40 t() calls with no messages (runtime MISSING_MESSAGE); all restored/added + official sync-ui stamps, and vi's zero-marker policy re-established via the sanctioned translation backend Stale sibling tests aligned (movers cited inline): chat-helpers (#9447), executor-antigravity (#9351), video-fal-grok (#9982), visionBridge (#9759), web-session-credentials (#8974), production-build-module-integrity (positive anchor added), agentSkills-generator/skillManifestsLint/skills-injection/ agentSkillTools-mcp/listCapabilities-a2a (#9058), memory-settings (#10010), model-catalog-policy-invalidation (#8906), model-alias-seed (#9485), reactive-context-compaction (#8949), combo-provider-wildcard (broken upsert helper), oauth-google-loopback (43-locale resurrected-key removal) Validation: 501/501 across the 47 touched test files; typecheck:core, lint, file-size, docs-sync all green. Refs #9985 * fix(ci): base-reds round 3g — wave K/L: 4 more real defects + stale alignments Real defects: - base/reasoningEffort.ts: the stale duplicate cherry-pick #9612 re-added the codex minimal→low rewrite that #9883 had deliberately removed (OMP minimal passthrough); block removed again - cursorImages.ts: #9840 wired prepareCursorImageForWire (sharp re-encode, fail-closed) into the SHARED resolveCursorImages, breaking zai-web and conol-web image uploads (HTTP 400 'undecodable'); new prepareForWire opt-out, Cursor default path unchanged (8 cursor suites green) - modelCapabilities/snapshot: catalog prepare still issued 323 per-model reads of model_context_overrides + max_input_tokens overrides, violating #9199's bulk-load contract; both now resolve from the snapshot single pass - v1-models-discovery-conformance: re-pinned to the bounded 30s SWR window (#9199/#10198) — the old 'stale-first regardless of age' contract is gone Stale tests aligned (movers cited inline): codex-tools-strict-default (#9828 redundant-oneOf strip), devin-providers (#9245 i18n), db-migrationrunner- constants-split (147→151 renumber #8228), gitlab-duo-oauth-setup (#9245), chatcore-extracted-modules (#9161 outbound-protocol keying) compression-api CI failures were cascade artifacts of codex-tools-strict-default failing in the same force-exit shard process — no own defect (171/171 local). Refs #9985 * fix(test): compression-api — register both describes before the runner starts The DATA_DIR setup + route/db top-level awaits sat BETWEEN the two describes; under --test-force-exit (the CI unit-runner flag) the process exits once the already-registered tests finish, so on slow CI machines the whole second describe died as 'Promise resolution is still pending' — the recurring CI-only shard-2 failure that never reproduced locally without the flag. Moved to the top of the file; 10/10 under --test-force-exit locally. Refs #9985 * fix(quality): freeze modelCapabilities.ts at 1006 (annotated) — snapshot routing growth Refs #9985 * fix(quality): move the modelCapabilities freeze into the frozen map (nested schema) Refs #9985 * fix(i18n): translate all 39,718 pending UI keys across 42 locales (owner-approved) Mass-translated every __MISSING__ placeholder via the official i18n:sync-ui --translate-markers pipeline (operator backend), restoring i18nUiCoverage to the 100 baseline (was 89.9 after the merge-storm UI landings + the 42 keys #9038 never shipped). Post-pass repairs, all caught by the existing gates: - glossary: retired renderings the machine reintroduced normalized again (提供商→提供者 zh-CN/zh-TW, 鏈接→連結, 文檔→文件, 調用→呼叫, 供應商→提供者, 響應→回應, 不活躍→未啟用 zh-TW; 클로드→Claude, 옴니루트→OmniRoute ko); DATA_DIR forbidden rendering avoided via 数据文件夹 rephrase - ICU integrity: 120 values with renamed/dropped {params} repaired (39 positional renames, 81 reset to the en source — functional over fluent) Validation: glossary/pt-BR/vi/deno-relay/settings-keys/value-drift/google- loopback suites 76/76; placeholder diff en×42 locales = 0; worst-locale coverage = 100.0%. Refs #9985 --------- Co-authored-by: backryun <bakryun0718@proton.me>
997 lines
34 KiB
TypeScript
997 lines
34 KiB
TypeScript
/**
|
|
* Image Generation Provider Registry
|
|
*
|
|
* Defines providers that support the /v1/images/generations endpoint.
|
|
* Each provider has its own request format and endpoint.
|
|
*/
|
|
|
|
import { LMARENA_DIRECT_IMAGE_MODELS } from "./providers/registry/lmarena/directModels.ts";
|
|
import { SEGMIND_IMAGE_PROVIDER } from "./providers/registry/segmind/imageModels.ts";
|
|
import { KIE_IMAGE_MODELS } from "./providers/registry/kie/imageModels.ts";
|
|
import { FREEPIK_IMAGE_PROVIDER } from "./providers/registry/freepik/index.ts";
|
|
import { STABILITY_AI_IMAGE_MODELS } from "./providers/registry/stability-ai/imageModels.ts";
|
|
import { GEMINI_IMAGEN_PROVIDER } from "./providers/registry/gemini/imageModels.ts";
|
|
import { CHEAPERINFERENCE_IMAGE_PROVIDER } from "./providers/registry/cheaperinference/imageModels.ts";
|
|
import {
|
|
ADOBE_FIREFLY_IMAGE_ROUTING_ALIASES,
|
|
toRegistryImageModels,
|
|
} from "../services/adobeFireflyModels.ts";
|
|
|
|
interface ImageModelEntry {
|
|
id: string;
|
|
name: string;
|
|
inputModalities?: string[];
|
|
// See STABILITY_AI_IMAGE_MODELS for why this exists: some models accept "text"
|
|
// but mechanically require an image regardless.
|
|
imageRequired?: boolean;
|
|
description?: string;
|
|
isMarket?: boolean;
|
|
supportedSizes?: string[];
|
|
mediaCapabilities?: Record<string, unknown>;
|
|
}
|
|
|
|
interface ImageProviderConfig {
|
|
id: string;
|
|
baseUrl: string;
|
|
fallbackUrl?: string;
|
|
proUrl?: string;
|
|
statusUrl?: string;
|
|
alias?: string;
|
|
authType: string;
|
|
authHeader: string;
|
|
format: string;
|
|
models: ImageModelEntry[];
|
|
routingAliases?: readonly string[];
|
|
supportedSizes: string[];
|
|
}
|
|
|
|
interface ImageModelAliasEntry {
|
|
provider: string;
|
|
model: string;
|
|
name: string;
|
|
listInCatalog: boolean;
|
|
inputModalities?: string[];
|
|
imageRequired?: boolean;
|
|
description?: string;
|
|
mediaCapabilities?: Record<string, unknown>;
|
|
}
|
|
|
|
interface ImageCatalogModelEntry {
|
|
id: string;
|
|
name: string;
|
|
provider: string;
|
|
supportedSizes: string[];
|
|
inputModalities: string[];
|
|
description?: string;
|
|
mediaCapabilities?: Record<string, unknown>;
|
|
}
|
|
|
|
const IMAGE_MODEL_ALIASES: Record<string, ImageModelAliasEntry> = {
|
|
"gemini-3.1-flash-image-preview": {
|
|
provider: "antigravity",
|
|
model: "gemini-3.1-flash-image",
|
|
name: "Gemini 3.1 Flash Image",
|
|
listInCatalog: false,
|
|
},
|
|
"flux-kontext": {
|
|
provider: "black-forest-labs",
|
|
model: "flux-kontext-pro",
|
|
name: "FLUX Kontext Pro",
|
|
listInCatalog: true,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
"flux-kontext-max": {
|
|
provider: "black-forest-labs",
|
|
model: "flux-kontext-max",
|
|
name: "FLUX Kontext Max",
|
|
listInCatalog: true,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
"flux-2-max": {
|
|
provider: "black-forest-labs",
|
|
model: "flux-2-max",
|
|
name: "FLUX.2 Max",
|
|
listInCatalog: true,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
"flux-2-pro": {
|
|
provider: "black-forest-labs",
|
|
model: "flux-2-pro",
|
|
name: "FLUX.2 Pro",
|
|
listInCatalog: true,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
"flux-2-flex": {
|
|
provider: "black-forest-labs",
|
|
model: "flux-2-flex",
|
|
name: "FLUX.2 Flex",
|
|
listInCatalog: true,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
"flux-2-dev": {
|
|
provider: "together",
|
|
model: "black-forest-labs/FLUX.2-dev",
|
|
name: "FLUX.2 Dev",
|
|
listInCatalog: true,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
kontext: {
|
|
provider: "black-forest-labs",
|
|
model: "flux-kontext-pro",
|
|
name: "FLUX Kontext Pro",
|
|
listInCatalog: false,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
"pollinations/kontext": {
|
|
provider: "black-forest-labs",
|
|
model: "flux-kontext-pro",
|
|
name: "FLUX Kontext Pro",
|
|
listInCatalog: false,
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
};
|
|
|
|
function resolveImageModelAlias(modelStr) {
|
|
const alias = IMAGE_MODEL_ALIASES[modelStr];
|
|
return alias ? { provider: alias.provider, model: alias.model } : null;
|
|
}
|
|
|
|
// A bare alias may only rewrite a provider-prefixed model when it stays on the
|
|
// SAME provider (e.g. `antigravity/gemini-3.1-flash-image-preview` →
|
|
// antigravity's callable `gemini-3.1-flash-image`). A cross-provider bare alias
|
|
// must NOT override an explicit prefix — #9982 removed the unconditional bare
|
|
// fallback because `fal-ai/flux-2-max` was being hijacked to black-forest-labs
|
|
// by the bare `flux-2-max` alias.
|
|
function resolveSameProviderBareAlias(providerId, model) {
|
|
const aliased = resolveImageModelAlias(model);
|
|
return aliased && aliased.provider === providerId ? aliased : null;
|
|
}
|
|
|
|
function findImageModelConfig(providerId, modelId) {
|
|
const provider = IMAGE_PROVIDERS[providerId];
|
|
if (!provider) return null;
|
|
return provider.models.find((model) => model.id === modelId) || null;
|
|
}
|
|
|
|
// Kept out of getImageModelEntry() (which sits at the complexity-ratchet cap) — an
|
|
// alias can override imageRequired directly, else it falls back to its target
|
|
// model's own flag. Consumers coerce the result with Boolean(), so no `?? false`.
|
|
function resolveAliasImageRequired(alias, modelConfig) {
|
|
return alias.imageRequired ?? modelConfig?.imageRequired;
|
|
}
|
|
|
|
export const IMAGE_PROVIDERS: Record<string, ImageProviderConfig> = {
|
|
agnes: {
|
|
id: "agnes",
|
|
baseUrl: "https://apihub.agnes-ai.com/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "agnes-image",
|
|
models: [
|
|
{
|
|
id: "agnes-image-2.1-flash",
|
|
name: "Agnes Image 2.1 Flash",
|
|
inputModalities: ["text", "image"],
|
|
description: "Agnes text-to-image, image-to-image, and multi-image composition model",
|
|
},
|
|
],
|
|
supportedSizes: ["1K", "2K", "3K", "4K"],
|
|
},
|
|
|
|
"qwen-cloud-token-plan": {
|
|
id: "qwen-cloud-token-plan",
|
|
alias: "qct",
|
|
baseUrl:
|
|
"https://token-plan.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "qwen-token-plan-image",
|
|
models: [
|
|
{
|
|
id: "wan2.7-image",
|
|
name: "Wan 2.7 Image",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "wan2.7-image-pro",
|
|
name: "Wan 2.7 Image Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
],
|
|
// Both models share 1K/2K support. The Pro model also accepts explicit 4K
|
|
// dimensions, which callers can still pass through the permissive request schema.
|
|
supportedSizes: ["1024x1024", "2048x2048"],
|
|
},
|
|
|
|
openai: {
|
|
id: "openai",
|
|
baseUrl: "https://api.openai.com/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai", // native OpenAI format
|
|
models: [
|
|
{ id: "gpt-image-2", name: "GPT Image 2" },
|
|
{ id: "gpt-image-1.5", name: "GPT Image 1.5" },
|
|
{ id: "gpt-image-1-mini", name: "GPT Image 1 Mini" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1792", "1792x1024"],
|
|
},
|
|
|
|
// Codex exposes image generation only as a Responses-API hosted tool under
|
|
// ChatGPT OAuth. Incoming GPT-Image-style `/v1/images/generations` requests are
|
|
// translated to /responses calls with `tools: [{ type: "image_generation" }]`
|
|
// by handleCodexImageGeneration.
|
|
codex: {
|
|
id: "codex",
|
|
alias: "cx",
|
|
baseUrl: "https://chatgpt.com/backend-api/codex/responses",
|
|
authType: "oauth",
|
|
authHeader: "bearer",
|
|
format: "codex-responses",
|
|
models: [
|
|
{ id: "gpt-5.6-sol", name: "GPT 5.6 Sol (Codex Image)" },
|
|
{ id: "gpt-5.6-terra", name: "GPT 5.6 Terra (Codex Image)" },
|
|
{ id: "gpt-5.6-luna", name: "GPT 5.6 Luna (Codex Image)" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1536", "1536x1024"],
|
|
},
|
|
|
|
"chatgpt-web": {
|
|
id: "chatgpt-web",
|
|
alias: "cgpt-web",
|
|
baseUrl: "https://chatgpt.com/backend-api/f/conversation",
|
|
authType: "apikey",
|
|
authHeader: "cookie",
|
|
format: "chatgpt-web",
|
|
models: [{ id: "gpt-5.5", name: "GPT-5.5 Instant (ChatGPT Web Image)" }],
|
|
supportedSizes: ["1024x1024", "1024x1536", "1536x1024"],
|
|
},
|
|
|
|
"microsoft-designer-web": {
|
|
id: "microsoft-designer-web",
|
|
alias: "msdesigner",
|
|
baseUrl:
|
|
"https://designerapp.officeapps.live.com/designerapp/DallE.ashx?action=GetDallEImagesCogSci",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "designer-web",
|
|
models: [{ id: "dall-e-3", name: "DALL-E 3 (Microsoft Designer Web)" }],
|
|
supportedSizes: ["1024x1024", "1792x1024", "1024x1792"],
|
|
},
|
|
|
|
xai: {
|
|
id: "xai",
|
|
baseUrl: "https://api.x.ai/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [
|
|
{ id: "grok-imagine-image-quality", name: "Grok Imagine Image Quality" },
|
|
{ id: "grok-imagine-image", name: "Grok Imagine Image" },
|
|
],
|
|
supportedSizes: ["1024x1024", "2048x2048"],
|
|
},
|
|
|
|
"vercel-ai-gateway": {
|
|
id: "vercel-ai-gateway",
|
|
alias: "vag",
|
|
baseUrl: "https://ai-gateway.vercel.sh/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [
|
|
{ id: "gpt-image-1", name: "GPT Image 1" },
|
|
{ id: "black-forest-labs/flux-1.1-pro", name: "FLUX 1.1 Pro" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1792", "1792x1024"],
|
|
},
|
|
|
|
together: {
|
|
id: "together",
|
|
baseUrl: "https://api.together.xyz/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [
|
|
{
|
|
id: "black-forest-labs/FLUX.2-max",
|
|
name: "FLUX.2 Max",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "black-forest-labs/FLUX.2-pro",
|
|
name: "FLUX.2 Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "black-forest-labs/FLUX.2-flex",
|
|
name: "FLUX.2 Flex",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "black-forest-labs/FLUX.2-dev",
|
|
name: "FLUX.2 Dev",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{ id: "openai/gpt-image-1.5", name: "GPT Image 1.5", inputModalities: ["text", "image"] },
|
|
{ id: "Wan-AI/Wan2.6-image", name: "Wan 2.6 Image", inputModalities: ["text", "image"] },
|
|
{
|
|
id: "Qwen/Qwen-Image-2.0-Pro",
|
|
name: "Qwen Image 2.0 Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{ id: "Qwen/Qwen-Image-2.0", name: "Qwen Image 2.0", inputModalities: ["text", "image"] },
|
|
{ id: "google/flash-image-3.1", name: "NanoBanana 2", inputModalities: ["text", "image"] },
|
|
{
|
|
id: "google/gemini-3-pro-image",
|
|
name: "NanoBanana Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
],
|
|
supportedSizes: ["1024x1024", "512x512"],
|
|
},
|
|
|
|
fireworks: {
|
|
id: "fireworks",
|
|
baseUrl: "https://api.fireworks.ai/inference/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [
|
|
{ id: "accounts/fireworks/flux-kontext-max", name: "FLUX Kontext Max" },
|
|
{ id: "accounts/fireworks/flux-kontext-pro", name: "FLUX Kontext Pro" },
|
|
{ id: "accounts/fireworks/flux-1-schnell-fp8", name: "FLUX.1 schnell" },
|
|
{ id: "accounts/fireworks/models/flux-1-dev-fp8", name: "FLUX 1 Dev FP8" },
|
|
{ id: "accounts/fireworks/models/stable-diffusion-xl-1024-v1-0", name: "SDXL 1024 v1.0" },
|
|
],
|
|
supportedSizes: ["1024x1024", "512x512"],
|
|
},
|
|
|
|
antigravity: {
|
|
id: "antigravity",
|
|
baseUrl: "https://daily-cloudcode-pa.googleapis.com/v1internal:generateContent",
|
|
authType: "oauth",
|
|
authHeader: "bearer",
|
|
format: "gemini-image", // Special format: uses Gemini generateContent API
|
|
models: [{ id: "gemini-3.1-flash-image", name: "Gemini 3.1 Flash Image" }],
|
|
supportedSizes: ["1024x1024"],
|
|
},
|
|
|
|
// Google AI Studio Imagen family — dedicated :predict endpoint, not generateContent.
|
|
// See providers/registry/gemini/imageModels.ts for the full rationale.
|
|
gemini: GEMINI_IMAGEN_PROVIDER,
|
|
|
|
//Curruntly no models serving
|
|
nebius: {
|
|
id: "nebius",
|
|
baseUrl: "https://api.tokenfactory.nebius.com/v1/images/generations",
|
|
fallbackUrl: "https://api.studio.nebius.com/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [{ id: "black-forest-labs/flux-schnell", name: "No Model yet" }],
|
|
supportedSizes: ["1024x1024"],
|
|
},
|
|
|
|
hyperbolic: {
|
|
id: "hyperbolic",
|
|
baseUrl: "https://api.hyperbolic.xyz/v1/image/generation",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "hyperbolic", // custom: uses model_name, returns base64 images
|
|
models: [{ id: "SDXL1.0-base", name: "No Model yet" }],
|
|
supportedSizes: ["1024x1024"],
|
|
},
|
|
//Curruntly no models serving
|
|
|
|
nanobanana: {
|
|
id: "nanobanana",
|
|
baseUrl: "https://api.nanobananaapi.ai/api/v1/nanobanana/generate",
|
|
proUrl: "https://api.nanobananaapi.ai/api/v1/nanobanana/generate-pro",
|
|
statusUrl: "https://api.nanobananaapi.ai/api/v1/nanobanana/record-info",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "nanobanana", // custom format (async: submit task, then poll)
|
|
models: [
|
|
{ id: "nanobanana-flash", name: "NanoBanana Flash (Gemini 2.5 Flash)" },
|
|
{ id: "nanobanana-pro", name: "NanoBanana Pro (Gemini 3 Pro)" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1280", "1024x1536", "1536x1024", "1280x1024"],
|
|
},
|
|
|
|
kie: {
|
|
id: "kie",
|
|
baseUrl: "https://api.kie.ai",
|
|
statusUrl: "https://api.kie.ai/api/v1/jobs/recordInfo",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "kie-image",
|
|
models: KIE_IMAGE_MODELS,
|
|
supportedSizes: ["1:1", "16:9", "9:16", "4:3", "3:4"],
|
|
},
|
|
|
|
haiper: {
|
|
id: "haiper",
|
|
baseUrl: "https://api.haiper.ai/v1/jobs/gen2/text2image",
|
|
statusUrl: "https://api.haiper.ai/v1/jobs",
|
|
authType: "apikey",
|
|
authHeader: "HAIPER_KEY",
|
|
format: "haiper-image",
|
|
models: [{ id: "gen2", name: "Gen 2 Image" }],
|
|
supportedSizes: ["16:9", "9:16", "1:1", "4:3", "3:4"],
|
|
},
|
|
// #2482: MiniMax already has entries in musicRegistry/audioRegistry/videoRegistry,
|
|
// but was missing an image provider entirely, so MiniMax image-model requests
|
|
// fell through the format dispatch below to a 400/unmatched-format response.
|
|
minimax: {
|
|
id: "minimax",
|
|
baseUrl: "https://api.minimax.io/v1/image_generation",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "minimax-image",
|
|
models: [
|
|
{ id: "image-01", name: "MiniMax Image-01" },
|
|
{ id: "image-01-live", name: "MiniMax Image-01 Live" },
|
|
],
|
|
supportedSizes: ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "1024x1024"],
|
|
},
|
|
leonardo: {
|
|
id: "leonardo",
|
|
baseUrl: "https://cloud.leonardo.ai/api/rest/v1/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "leonardo-image",
|
|
models: [
|
|
{ id: "phoenix", name: "Phoenix" },
|
|
{ id: "sdxl", name: "SDXL" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x576", "576x1024"],
|
|
},
|
|
ideogram: {
|
|
id: "ideogram",
|
|
baseUrl: "https://api.ideogram.ai/generate",
|
|
authType: "apikey",
|
|
authHeader: "Api-Key",
|
|
format: "ideogram-image",
|
|
models: [
|
|
{ id: "V_3", name: "Ideogram V3" },
|
|
{ id: "V_2A", name: "Ideogram V2A" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1792", "1792x1024"],
|
|
},
|
|
freepik: FREEPIK_IMAGE_PROVIDER,
|
|
sdwebui: {
|
|
id: "sdwebui",
|
|
baseUrl: "http://localhost:7860/sdapi/v1/txt2img",
|
|
authType: "none",
|
|
authHeader: "none",
|
|
format: "sdwebui",
|
|
models: [
|
|
{ id: "stable-diffusion-v1-5", name: "Stable Diffusion v1.5" },
|
|
{ id: "sdxl-base-1.0", name: "SDXL Base 1.0" },
|
|
],
|
|
supportedSizes: ["512x512", "768x768", "1024x1024"],
|
|
},
|
|
|
|
comfyui: {
|
|
id: "comfyui",
|
|
baseUrl: "http://localhost:8188",
|
|
authType: "none",
|
|
authHeader: "none",
|
|
format: "comfyui",
|
|
models: [
|
|
{ id: "flux-dev", name: "FLUX Dev" },
|
|
{ id: "sdxl", name: "SDXL" },
|
|
],
|
|
supportedSizes: ["512x512", "768x768", "1024x1024"],
|
|
},
|
|
|
|
openrouter: {
|
|
id: "openrouter",
|
|
baseUrl: "https://openrouter.ai/api/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [
|
|
{ id: "openai/gpt-5.4-image-2", name: "GPT Image 2 (via OpenRouter)" },
|
|
{ id: "openai/gpt-5-image-mini", name: "GPT Image 1 Mini (via OpenRouter)" },
|
|
{ id: "google/gemini-3.1-flash-image-preview", name: "Nano Banana 2 (via OpenRouter)" },
|
|
{ id: "google/gemini-3-pro-image-preview", name: "Nano Banana Pro (via OpenRouter)" },
|
|
{ id: "black-forest-labs/flux.2-max", name: "FLUX.2 Max (via OpenRouter)" },
|
|
{ id: "black-forest-labs/flux.2-pro", name: "FLUX.2 Pro (via OpenRouter)" },
|
|
{ id: "black-forest-labs/flux.2-flex", name: "FLUX.2 Flex (via OpenRouter)" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1792", "1792x1024"],
|
|
},
|
|
|
|
pollinations: {
|
|
id: "pollinations",
|
|
alias: "pol",
|
|
baseUrl: "https://gen.pollinations.ai/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [
|
|
{ id: "klein", name: "FLUX.2 Klein 4B" },
|
|
{ id: "flux", name: "Flux Schnell" },
|
|
{ id: "zimage", name: "Z-Image Turbo" },
|
|
{ id: "qwen-image", name: "Qwen Image Plus" },
|
|
{ id: "wan-image", name: "Wan 2.7 Image" },
|
|
{ id: "gpt-image-2", name: "GPT Image 2" },
|
|
{ id: "gptimage-large", name: "GPT Image 1.5" },
|
|
{ id: "gptimage", name: "GPT Image 1 Mini" },
|
|
],
|
|
supportedSizes: ["1024x1024", "512x512"],
|
|
},
|
|
|
|
"fal-ai": {
|
|
id: "fal-ai",
|
|
baseUrl: "https://fal.run",
|
|
authType: "apikey",
|
|
authHeader: "key",
|
|
format: "fal-ai",
|
|
models: [
|
|
{ id: "flux-2-max", name: "FLUX.2 Max" },
|
|
{ id: "flux-2-pro", name: "FLUX.2 Pro" },
|
|
{ id: "flux-2-flex", name: "FLUX.2 Flex" },
|
|
{ id: "bria/text-to-image/3.2", name: "Bria 3.2" },
|
|
{ id: "bytedance/seedream/v4.5/text-to-image", name: "SeeDream V4.5" },
|
|
{ id: "bytedance/dreamina/v3.1/text-to-image", name: "Dreamina V3.1" },
|
|
{ id: "ideogram/v3", name: "Ideogram V3" },
|
|
// Prefix-only on purpose: adobe-firefly owns the bare nano-banana ids
|
|
// (operator decision 2026-07-31, pinned by cheaperinference-image-models
|
|
// guard). The dispatch path tolerates the fal-ai/ prefix (fal.ts).
|
|
{ id: "fal-ai/nano-banana-pro", name: "Nano Banana Pro" },
|
|
{ id: "fal-ai/nano-banana-2", name: "Nano Banana 2" },
|
|
{ id: "recraft/v4/pro/text-to-image", name: "Recraft V4 Pro via Fal" },
|
|
{ id: "recraft/v4/text-to-image", name: "Recraft V4 via Fal" },
|
|
{ id: "stable-diffusion-v35-medium", name: "Stable Diffusion v3.5 Medium" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1280", "1280x1024"],
|
|
},
|
|
|
|
"stability-ai": {
|
|
id: "stability-ai",
|
|
baseUrl: "https://api.stability.ai",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "stability-ai",
|
|
models: STABILITY_AI_IMAGE_MODELS,
|
|
supportedSizes: ["1024x1024", "1024x1280", "1280x1024"],
|
|
},
|
|
|
|
"black-forest-labs": {
|
|
id: "black-forest-labs",
|
|
baseUrl: "https://api.bfl.ai",
|
|
authType: "apikey",
|
|
authHeader: "x-key",
|
|
format: "black-forest-labs",
|
|
models: [
|
|
{ id: "flux-2-max", name: "FLUX.2 Max" },
|
|
{ id: "flux-2-pro", name: "FLUX.2 Pro" },
|
|
{ id: "flux-2-flex", name: "FLUX.2 Flex" },
|
|
{ id: "flux-pro-1.1-ultra", name: "flux-pro-1.1-ultra" },
|
|
{ id: "flux-pro-1.1", name: "flux-pro-1.1" },
|
|
{ id: "flux-2-klein-9b", name: "flux 2 Klein 9B" },
|
|
{ id: "flux-2-klein-4b", name: "flux 2 Klein 4B" },
|
|
{ id: "flux-kontext-max", name: "flux-kontext-max", inputModalities: ["text", "image"] },
|
|
{ id: "flux-kontext-pro", name: "flux-kontext-pro", inputModalities: ["text", "image"] },
|
|
{ id: "flux-dev", name: "flux-dev" },
|
|
{ id: "flux-pro", name: "flux-pro" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1280", "1280x1024"],
|
|
},
|
|
|
|
recraft: {
|
|
id: "recraft",
|
|
baseUrl: "https://external.api.recraft.ai",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "recraft",
|
|
models: [
|
|
{ id: "recraftv4_pro", name: "Recraft V4 Pro" },
|
|
{ id: "recraftv4", name: "Recraft V4" },
|
|
{ id: "recraftv3", name: "Recraft V3" },
|
|
{ id: "recraftv2", name: "Recraft V2" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1280", "1280x1024"],
|
|
},
|
|
|
|
topaz: {
|
|
id: "topaz",
|
|
baseUrl: "https://api.topazlabs.com",
|
|
authType: "apikey",
|
|
authHeader: "x-api-key",
|
|
format: "topaz",
|
|
models: [{ id: "topaz-enhance", name: "topaz-enhance", inputModalities: ["image"] }],
|
|
supportedSizes: ["1024x1024"],
|
|
},
|
|
|
|
// Segmind (#6656): 200+ models, `POST /v1/{model}`, x-api-key, raw image bytes.
|
|
segmind: SEGMIND_IMAGE_PROVIDER,
|
|
nanogpt: {
|
|
id: "nanogpt",
|
|
baseUrl: "https://nano-gpt.com/api/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [
|
|
{ id: "qwen-image", name: "Qwen Image", inputModalities: ["text", "image"] },
|
|
{ id: "z-image-turbo", name: "Z Image Turbo" },
|
|
{ id: "chroma", name: "Chroma" },
|
|
{ id: "hidream", name: "Hidream I1 Full" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1024x1280", "1280x1024"],
|
|
},
|
|
|
|
// NVIDIA NIM image generation (FLUX models). Distinct from the NVIDIA *chat* entry
|
|
// (open-sse/config/providers/registry/nvidia/index.ts, host integrate.api.nvidia.com,
|
|
// OpenAI-compatible) — image generation lives on ai.api.nvidia.com/v1/genai/<model>
|
|
// with a native NIM body per model, so it gets a dedicated `nvidia-nim` format/handler
|
|
// (handleNvidiaNimImageGeneration) rather than reusing the OpenAI image path.
|
|
// Ported from upstream 9router#1195.
|
|
nvidia: {
|
|
id: "nvidia",
|
|
baseUrl: "https://ai.api.nvidia.com/v1/genai",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "nvidia-nim",
|
|
models: [
|
|
{
|
|
id: "black-forest-labs/flux.1-dev",
|
|
name: "FLUX.1 Dev",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{ id: "black-forest-labs/flux.1-schnell", name: "FLUX.1 Schnell" },
|
|
{
|
|
id: "black-forest-labs/flux.1-kontext-dev",
|
|
name: "FLUX.1 Kontext Dev (Edit)",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "black-forest-labs/flux.2-klein-4b",
|
|
name: "FLUX.2 Klein 4B",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
],
|
|
supportedSizes: ["1024x1024", "768x1344", "512x512"],
|
|
},
|
|
|
|
// SenseNova (商汤日日新) Text-to-Image on the free Token Plan. OpenAI-compatible
|
|
// `/v1/images/generations`, so the generic OpenAI image handler routes it — same
|
|
// SenseNova api-key/connection as the chat provider. (9router#2233)
|
|
sensenova: {
|
|
id: "sensenova",
|
|
baseUrl: "https://api.sensenova.cn/v1/images/generations",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "openai",
|
|
models: [{ id: "sensenova-u1-fast", name: "SenseNova U1 Fast" }],
|
|
supportedSizes: ["1024x1024"],
|
|
},
|
|
|
|
// HuggingFace Hub Inference API text-to-image task. Returns raw image bytes
|
|
// (not JSON), so it uses a dedicated "huggingface-image" format handled by
|
|
// handleHuggingFaceImageGeneration. Same base URL convention as the HF
|
|
// STT/TTS entries in audioRegistry.ts. Model list is deliberately small —
|
|
// the dashboard's "suggested models" chip row (GET
|
|
// /api/v1/providers/suggested-models) surfaces additional HF Hub models
|
|
// beyond this seed list.
|
|
huggingface: {
|
|
id: "huggingface",
|
|
// HF retired api-inference.huggingface.co; text-to-image now routes through
|
|
// router.huggingface.co with the hf-inference provider pinned in the path.
|
|
baseUrl: "https://router.huggingface.co/hf-inference/models",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "huggingface-image",
|
|
models: [
|
|
{ id: "black-forest-labs/FLUX.1-dev", name: "FLUX.1 Dev (HF)" },
|
|
{ id: "black-forest-labs/FLUX.1-schnell", name: "FLUX.1 Schnell (HF)" },
|
|
{ id: "stabilityai/stable-diffusion-xl-base-1.0", name: "Stable Diffusion XL (HF)" },
|
|
],
|
|
supportedSizes: ["1024x1024"],
|
|
},
|
|
|
|
// Arena (formerly LMArena) Direct-chat Image category (static scrape 2026-07-09).
|
|
// Not listed in the chat registry — image catalog only. Generation path still
|
|
// uses cookie session auth via the lmarena provider connection (stable wire id).
|
|
lmarena: {
|
|
id: "lmarena",
|
|
alias: "lma",
|
|
baseUrl: "https://arena.ai/nextjs-api/stream/create-evaluation",
|
|
authType: "apikey",
|
|
authHeader: "cookie",
|
|
format: "openai",
|
|
models: LMARENA_DIRECT_IMAGE_MODELS,
|
|
supportedSizes: ["1024x1024", "1024x1792", "1792x1024"],
|
|
},
|
|
|
|
// Adobe Firefly (unofficial) — IMS access_token (clio-playground-web) or browser
|
|
// Cookie from firefly.adobe.com. Async 3P image generate + poll.
|
|
// Model list = static fallback from models/discovery capture; live discovery
|
|
// refreshes via resolveAdobeFireflyCatalog when credentials work.
|
|
"adobe-firefly": {
|
|
id: "adobe-firefly",
|
|
alias: "firefly",
|
|
baseUrl: "https://firefly-3p.ff.adobe.io/v2/3p-images/generate-async",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "adobe-firefly-image",
|
|
models: toRegistryImageModels(),
|
|
routingAliases: ADOBE_FIREFLY_IMAGE_ROUTING_ALIASES,
|
|
supportedSizes: [],
|
|
},
|
|
|
|
// Cheaper Inference (OSS-sponsor gateway). Declared AFTER adobe-firefly on
|
|
// purpose: it shares the nano-banana-pro / nano-banana-2 ids, and parseImageModel
|
|
// resolves a bare id by first-match over this object's iteration order, so
|
|
// Firefly keeps the bare ids and these are prefix-only. See the module for the
|
|
// full collision note.
|
|
cheaperinference: CHEAPERINFERENCE_IMAGE_PROVIDER,
|
|
|
|
// Keep Bailian Coding Plan after existing duplicate model owners so adding
|
|
// explicit `bailian-coding-plan/` and `bcp/` routes does not change
|
|
// historical bare-model routing.
|
|
"bailian-coding-plan": {
|
|
id: "bailian-coding-plan",
|
|
alias: "bcp",
|
|
baseUrl:
|
|
"https://coding-intl.dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "bailian-coding-plan-image",
|
|
models: [
|
|
{
|
|
id: "wan2.7-image",
|
|
name: "Wan 2.7 Image",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "wan2.7-image-pro",
|
|
name: "Wan 2.7 Image Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "qwen-image-2.0",
|
|
name: "Qwen Image 2.0",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "qwen-image-2.0-pro",
|
|
name: "Qwen Image 2.0 Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
],
|
|
supportedSizes: ["1024x1024", "2048x2048"],
|
|
},
|
|
|
|
// Keep Alibaba after existing duplicate model owners so adding explicit
|
|
// `alibaba/` and `ali/` routes does not change historical bare-model routing.
|
|
alibaba: {
|
|
id: "alibaba",
|
|
alias: "ali",
|
|
baseUrl:
|
|
"https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "alibaba-image",
|
|
models: [
|
|
{
|
|
id: "qwen-image-3.0-pro",
|
|
name: "Qwen Image 3.0 Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "qwen-image-2.0-pro-2026-06-22",
|
|
name: "Qwen Image 2.0 Pro (2026-06-22)",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "qwen-image-2.0",
|
|
name: "Qwen Image 2.0",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{ id: "z-image-turbo", name: "Z-Image Turbo" },
|
|
{ id: "wan2.6-t2i", name: "Wan 2.6 T2I" },
|
|
],
|
|
supportedSizes: ["1024x1024", "1280x1280", "2048x2048"],
|
|
},
|
|
|
|
// Keep regular Qwen Cloud isolated from Alibaba, Bailian Coding Plan, and
|
|
// Qwen Cloud Token Plan. Explicit `qwen-cloud/` or `qwc/` routes use only
|
|
// the regular Qwen Cloud connection and its regional DashScope endpoint.
|
|
"qwen-cloud": {
|
|
id: "qwen-cloud",
|
|
alias: "qwc",
|
|
baseUrl:
|
|
"https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
|
|
authType: "apikey",
|
|
authHeader: "bearer",
|
|
format: "qwen-cloud-image",
|
|
models: [
|
|
{
|
|
id: "wan2.7-image-pro",
|
|
name: "Wan 2.7 Image Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "wan2.7-image",
|
|
name: "Wan 2.7 Image",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "qwen-image-3.0-pro",
|
|
name: "Qwen Image 3.0 Pro",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "qwen-image-2.0-pro-2026-06-22",
|
|
name: "Qwen Image 2.0 Pro (2026-06-22)",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{
|
|
id: "qwen-image-2.0-2026-03-03",
|
|
name: "Qwen Image 2.0 (2026-03-03)",
|
|
inputModalities: ["text", "image"],
|
|
},
|
|
{ id: "z-image-turbo", name: "Z-Image Turbo" },
|
|
],
|
|
// 1K/2K are shared by the whole catalog. Wan 2.7 Image Pro callers can
|
|
// still pass supported 4K dimensions through the permissive request schema.
|
|
supportedSizes: ["1024x1024", "2048x2048"],
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Get image provider config by ID
|
|
*/
|
|
export function getImageProvider(providerId) {
|
|
return IMAGE_PROVIDERS[providerId] || null;
|
|
}
|
|
|
|
/**
|
|
* Parse image model string (format: "provider/model")
|
|
* Returns { provider, model }
|
|
*/
|
|
export function parseImageModel(modelStr) {
|
|
if (!modelStr) return { provider: null, model: null };
|
|
|
|
const directAlias = resolveImageModelAlias(modelStr);
|
|
if (directAlias) {
|
|
return directAlias;
|
|
}
|
|
|
|
// Try each provider prefix
|
|
for (const [providerId, config] of Object.entries(IMAGE_PROVIDERS)) {
|
|
if (modelStr.startsWith(providerId + "/")) {
|
|
const model = modelStr.slice(providerId.length + 1);
|
|
const aliased =
|
|
resolveImageModelAlias(`${providerId}/${model}`) ||
|
|
resolveSameProviderBareAlias(providerId, model);
|
|
return aliased || { provider: providerId, model };
|
|
}
|
|
// Check alias if available
|
|
if (config.alias && modelStr.startsWith(config.alias + "/")) {
|
|
const model = modelStr.slice(config.alias.length + 1);
|
|
const aliased =
|
|
resolveImageModelAlias(`${providerId}/${model}`) ||
|
|
resolveSameProviderBareAlias(providerId, model);
|
|
return aliased || { provider: providerId, model };
|
|
}
|
|
}
|
|
|
|
// No provider prefix — try to find the model in every provider
|
|
for (const [providerId, config] of Object.entries(IMAGE_PROVIDERS)) {
|
|
if (config.routingAliases?.includes(modelStr) || config.models.some((m) => m.id === modelStr)) {
|
|
return { provider: providerId, model: modelStr };
|
|
}
|
|
}
|
|
|
|
return { provider: null, model: modelStr };
|
|
}
|
|
|
|
/**
|
|
* Get all image models as a flat list
|
|
*/
|
|
function imageProviderCatalogEntries(
|
|
providerId: string,
|
|
config: ImageProviderConfig
|
|
): ImageCatalogModelEntry[] {
|
|
return config.models.map((model) => ({
|
|
id: `${providerId}/${model.id}`,
|
|
name: model.name,
|
|
provider: providerId,
|
|
supportedSizes: model.supportedSizes || config.supportedSizes,
|
|
inputModalities: model.inputModalities || ["text"],
|
|
description: model.description || undefined,
|
|
mediaCapabilities: model.mediaCapabilities,
|
|
}));
|
|
}
|
|
|
|
function imageAliasCatalogEntry(
|
|
alias: string,
|
|
target: ImageModelAliasEntry
|
|
): ImageCatalogModelEntry | null {
|
|
if (!target.listInCatalog) return null;
|
|
|
|
const providerConfig = IMAGE_PROVIDERS[target.provider];
|
|
const modelConfig = findImageModelConfig(target.provider, target.model);
|
|
return {
|
|
id: alias,
|
|
name: target.name || modelConfig?.name || alias,
|
|
provider: target.provider,
|
|
supportedSizes: providerConfig?.supportedSizes || [],
|
|
inputModalities: target.inputModalities || modelConfig?.inputModalities || ["text"],
|
|
description: target.description || modelConfig?.description || undefined,
|
|
};
|
|
}
|
|
|
|
export function getAllImageModels(): ImageCatalogModelEntry[] {
|
|
const providerModels = Object.entries(IMAGE_PROVIDERS).flatMap(([providerId, config]) =>
|
|
imageProviderCatalogEntries(providerId, config)
|
|
);
|
|
const aliasModels = Object.entries(IMAGE_MODEL_ALIASES).flatMap(([alias, target]) => {
|
|
const entry = imageAliasCatalogEntry(alias, target);
|
|
return entry ? [entry] : [];
|
|
});
|
|
return [...providerModels, ...aliasModels];
|
|
}
|
|
|
|
export function getImageModelAliases() {
|
|
return IMAGE_MODEL_ALIASES;
|
|
}
|
|
|
|
/**
|
|
* #6457 — precise provider+modelId membership check against the image registry.
|
|
* Unlike getImageModelEntry() (which also resolves bare aliases and unprefixed
|
|
* ids by scanning every provider), this only answers "is `modelId` registered
|
|
* as an image model under this exact `providerId`?" — used by the chat catalog
|
|
* builder to keep upstream-discovered models (e.g. HuggingFace's live
|
|
* `/v1/models`, which returns image/diffusion models with no modality field)
|
|
* out of the chat listing when they are already known image-only models.
|
|
*/
|
|
export function isRegisteredImageModel(providerId, modelId) {
|
|
return Boolean(findImageModelConfig(providerId, modelId));
|
|
}
|
|
export function getImageModelEntry(modelStr) {
|
|
if (!modelStr) return null;
|
|
|
|
const alias = IMAGE_MODEL_ALIASES[modelStr];
|
|
if (alias) {
|
|
const modelConfig = findImageModelConfig(alias.provider, alias.model);
|
|
return {
|
|
provider: alias.provider,
|
|
model: alias.model,
|
|
inputModalities: alias.inputModalities || modelConfig?.inputModalities || ["text"],
|
|
imageRequired: resolveAliasImageRequired(alias, modelConfig),
|
|
description: alias.description || modelConfig?.description || undefined,
|
|
};
|
|
}
|
|
|
|
const { provider, model } = parseImageModel(modelStr);
|
|
if (!provider || !model) return null;
|
|
|
|
const modelConfig = findImageModelConfig(provider, model);
|
|
if (!modelConfig) return null;
|
|
|
|
return {
|
|
provider,
|
|
model,
|
|
inputModalities: modelConfig.inputModalities || ["text"],
|
|
imageRequired: modelConfig.imageRequired,
|
|
description: modelConfig.description || undefined,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* An image input is only MANDATORY for edit-only models — those whose modalities
|
|
* are `["image"]` with no `"text"`. Models listing both `["text", "image"]` accept
|
|
* an image but can also run pure text-to-image, so they must NOT be gated on an
|
|
* image input (that gate previously blocked 41 dual-modality t2i models).
|
|
*/
|
|
export function modalitiesRequireImageInput(inputModalities) {
|
|
const list = Array.isArray(inputModalities) ? inputModalities : ["text"];
|
|
return list.includes("image") && !list.includes("text");
|
|
}
|