Skip to content

Plugin submission: Yir 1.0.0 #6

Open

Description

@GargantuaX

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 the doubao plugin's model IDs and request fields (Ark body in metadata for video, Ark image fields for images).
    • Veo 3.1 and Veo 3.1 Fast on /v1/videos with the google plugin's IDs and fields (Gemini parameters in metadata), plus the -generate-001 GA 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 on openai_image would pin every request for them to Task Plugin channels; operators who want Yir to serve a bare ID can add a channel model mapping.
  • 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 /yir prefix.
  • Billing: one credit field, 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 settled billing.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 the yir::<model> provider override.
  • baseUrl is https://gateway.yir.ai; no allowedHosts. Requests go only to the channel base URL with Authorization: Bearer <channel key> and an Idempotency-Key derived from the gateway task id. Result files are presigned R2 URLs, fetched by buildContentRequest with credentialless: true (GET only).
  • Single file, synchronous, no imports. Sidecar icon.svg is our logo with a dark-mode variant; English and zh-CN changelogs are included.

Checks run:

  • go run . generate ../.. regenerated index.json (only the new plugin entry was added) and go run . check ../.. reports index.json is up to date.
  • new-api plugin lint and new-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/generations and one video through /v1/videos (poll, /content download 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions