Repository navigation
Description
PR creation on this repo is limited to collaborators, so I'm submitting the plugin as an issue. The ready branch is https://github.com/yir-ai/new-api-plugins/tree/yir-1.0.0 (compare: main...yir-ai:new-api-plugins:yir-1.0.0). If you'd prefer a different submission path, let me know.
Adds a task plugin for Yir (https://yir.ai), an image and video API router. We run Yir, so we are the operator of the service this plugin talks to.
Many New API gateways serve LLMs only. This plugin lets an operator add image and video generation with one Task Plugin channel and one Yir API key, and lets Yir act as one more channel for models the official plugins already declare.
What the plugin does:
- Models and request shapes:
- Seedance 1.5 pro / 2.0 / 2.0 fast / 2.0 mini / 2.5 on
/v1/videos, and Seedream 4.5 / 5.0 / 5.0 pro on/v1/images/*, with thedoubaoplugin's model IDs and request fields (Ark body inmetadatafor video, Ark image fields for images). - Veo 3.1 and Veo 3.1 Fast on
/v1/videoswith thegoogleplugin's IDs and fields (Gemini parameters inmetadata), plus the-generate-001GA names. - GPT Image 2 / GPT Image 1 and Nano Banana 2 / Pro on
/v1/images/*in the OpenAI Images shape, under prefixed IDs (openai/gpt-image-2,google/nano-banana-2, ...). The bare IDs are served by the built-in OpenAI and Gemini relays, and claiming them onopenai_imagewould pin every request for them to Task Plugin channels; operators who want Yir to serve a bare ID can add a channel model mapping.
- Seedance 1.5 pro / 2.0 / 2.0 fast / 2.0 mini / 2.5 on
- Translation: each request is translated into Yir's Standard API (
POST /v1/images|videos/generations). Parameters the client omits get the vendor's default written out explicitly (for example 5 s / 720p / audio on for Seedance), so a request means the same on this channel as on the vendor's. Anything without an exact Yir equivalent is rejected with a readable message rather than approximated or dropped (unknown fields,quality: auto, adaptive ratio where Yir has none, uploads/data URLs,n > 1, masks, group generation, ...). References must be public https URLs. - Routes:
POST /yir/v1/images/generations,POST /yir/v1/videos/generations,GET /yir/v1/jobs/:task_id(Yir Standard requests and Job objects).upstreams: ["vendor", "new_api"]; on a New API upstream the driver uses the/yirprefix. - Billing: one
creditfield,usd= the Yir job's charge in US dollars, priced e.g.tier("base", u("usd") * 1). The reservation is Yir's quote for the requested spec (a static table in the plugin); a video settles on the job's settledbilling.total_charged_by_yir; an image is returned as soon as it is ready and settles on the actual charge if Yir has billed it by then, otherwise on the estimate. Shared models are priced through theyir::<model>provider override. baseUrlishttps://gateway.yir.ai; noallowedHosts. Requests go only to the channel base URL withAuthorization: Bearer <channel key>and anIdempotency-Keyderived from the gateway task id. Result files are presigned R2 URLs, fetched bybuildContentRequestwithcredentialless: true(GET only).- Single file, synchronous, no imports. Sidecar
icon.svgis our logo with a dark-mode variant; English and zh-CN changelogs are included.
Checks run:
go run . generate ../..regeneratedindex.json(only the new plugin entry was added) andgo run . check ../..reportsindex.json is up to date.new-api plugin lintandnew-api plugin test --fixture(62 cases covering every exported hook and the main error branches) pass on v1.0.0-rc.45; the fixture and harness live in our own repository, per AGENTS.md.- End to end on a fresh v1.0.0-rc.45: plugin upload with icon, Task Plugin channel with an empty Base URL (the default applied), one image through
/v1/images/generationsand one video through/v1/videos(poll,/contentdownload and Range), with the gateway's settled quota matching the Yir job's charge.
We can provide a test key for review if that helps.
Activity