@felores/kie-ai-openai-server

中文文档
0.11.0发布于 2026/10/28MITTypeScriptES Module构建来源已验证近 30 天下载 2707

OpenAI-compatible HTTP transport for selected Kie.ai image and video models.

原始使用文档
文档目录3 节
  1. Embedded router
  2. Standalone server
  3. Client compatibility

@felores/kie-ai-openai-server

OpenAI-compatible HTTP transport for selected Kie.ai image and video models.

Embedded router

The embedded router owns provider request validation and response normalization. Its host application must authenticate callers before mounting it.

import { createKieOpenAiRouter } from "@felores/kie-ai-openai-server";

app.use(
  "/kie",
  existingAuthentication,
  createKieOpenAiRouter({
    apiKey: process.env.KIE_AI_API_KEY,
    dataDir: process.env.KIE_OPENAI_DATA_DIR,
  }),
);

GET /kie/health returns only readiness, contract version, and package version. The router never reads a local bearer token and never exposes the KIE API key.

GET /kie/v1/models returns the local OpenAI-shaped model catalog. It remains available without a Kie API key because discovery does not contact the provider.

Standalone server

KIE_AI_API_KEY=<KIE_API_KEY> \
KIE_OPENAI_TOKEN=<LOCAL_BEARER_TOKEN> \
kie-ai-openai-server

The standalone server binds to 127.0.0.1:51311 by default and refuses non-loopback hosts. Configure it with:

  • KIE_OPENAI_HOST: 127.0.0.1, localhost, or ::1
  • KIE_OPENAI_PORT: listening port
  • KIE_OPENAI_TOKEN: required local bearer token
  • KIE_OPENAI_ALLOWED_ORIGINS: optional comma-separated additional origins
  • KIE_OPENAI_DATA_DIR: transport-owned task data
  • KIE_AI_API_KEY: server-side Kie.ai credential
  • KIE_AI_BASE_URL: optional Kie.ai API base URL

Every non-preflight request requires Authorization: Bearer <LOCAL_BEARER_TOKEN>. Provider credentials, callback URLs, and remote output URLs are rejected in client request bodies.

Client compatibility

ModelImage format or video preset
kie-nano-banana-imageoutput_format=png, jpg, or jpeg (jpeg normalizes to jpg)
kie-z-imagegeneration only; PNG output and standard ratios
kie-seedream-5-pro-imageGeneration/editing; PNG or JPEG; 1K/2K; up to 10 references
kie-qwen-imageQwen3 generation/editing; PNG or JPEG; 1K/2K; up to three references
kie-flux-2-pro-imageGeneration/editing; fixed PNG; 1K/2K; up to 8 references
kie-flux-kontext-pro-imageGeneration/editing; PNG or JPEG; one reference
kie-gpt-image-2GPT Image 2.5 Flare; fixed PNG; omit output_format or use png
kie-bytedance-videoOmit preset or use preset=normal
kie-bytedance-fast-videoSame fixed Seedance 2.5 route and preset behavior
kie-kling-3-videoText/image-to-video; preset=std or pro; native audio via generate_audio
kie-minimax-h3-videoText/image/reference-to-video; use the matching preset for ambiguous image references
kie-veo3-videoText/image-to-video; preset=veo3 or veo3_fast; fixed provider duration
kie-wan-3-0-videoText, keyframe, and multimodal reference-to-video; kie-wan-2-7-video remains an alias
kie-happyhorse-1-1-videoHappyHorse 1.1 text/image/reference-to-video; old 1.0 ID is an alias; editing is not exposed
kie-midjourney-videoImage-to-video only; exactly one image reference; standard motion mode
kie-grok-videoText/image-to-video; preset=normal; one image reference for image mode

Explicit image formats are verified against the result MIME type and file signature. Masks and background=transparent are unsupported and fail before provider work.

MCP/CLI provide the wider selectors for GPT Sunburst, Seedream Flash/layers, Qwen3 Pro, and Wan Prime. Wan Image/Image Pro are excluded from this transport's one-result-per-task image contract. Current upgrades have mocked-contract proofs, not paid generation results.

Image size accepts an explicit model-supported ratio such as 16:9, or pixel dimensions such as 1824x1024. Explicit ratio strings remain strict. Pixel dimensions within a bounded 3% logarithmic tolerance map to the nearest ratio supported by the selected model. The transport does not resize or crop output; the provider still generates its declared ratio. quality selects resolution independently from aspect ratio.

For Infinite Canvas, use http://127.0.0.1:51311 as the base URL and the value of KIE_OPENAI_TOKEN as the API key. Do not append /v1.

版本与发布记录

@felores/kie-ai-openai-server 共发布 12 个版本,首次发布于 2026/07/15;过去 12 个月发布了 12 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.11.0latest2026/10/2817 天前
0.10.02026/10/2817 天前
0.9.22026/10/2817 天前
0.9.12026/10/2817 天前
0.9.02026/10/2817 天前
0.8.02026/10/061 个月前

关于 @felores/kie-ai-openai-server 的常见问题

@felores/kie-ai-openai-server 是什么?

OpenAI-compatible HTTP transport for selected Kie.ai image and video models.

如何安装 @felores/kie-ai-openai-server?

在项目目录运行 npm install @felores/kie-ai-openai-server,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 kie-ai-openai-server,可以用 npx kie-ai-openai-server 直接运行。

@felores/kie-ai-openai-server 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@felores/kie-ai-openai-server 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@felores/kie-ai-openai-server 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@felores/kie-ai-openai-server 可以商用吗?

@felores/kie-ai-openai-server 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@felores/kie-ai-openai-server 的下载量有多少?

根据 npm 官方下载统计,@felores/kie-ai-openai-server 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,707 次,日均约 90 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@felores/kie-ai-openai-server 还在维护吗?

最新版本 0.11.0 发布于 2026/10/28(17 天前);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/07/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。