Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

1.4 KB
Raw Blame
// AdobeFireflyExecutor — chat-completions guard for the adobe-firefly
// web-cookie media provider.
//
// Adobe Firefly is image/video generation only (Firefly 3P async APIs). There
// is no chat/completions surface. Real work lives in:
//   open-sse/handlers/imageGeneration/providers/adobeFirefly.ts
//   open-sse/handlers/videoGeneration/adobeFireflyHandler.ts
//
// Without this executor, getExecutor("adobe-firefly") would fall through to
// DefaultExecutor and mis-route the user's IMS token / cookie to api.openai.com.

import { BaseExecutor, type ExecuteInput } from "./base.ts";
import { makeExecutorErrorResult } from "../utils/error.ts";

const ADOBE_FIREFLY_BASE_URL = "https://firefly-3p.ff.adobe.io/v2/3p-images/generate-async";

export class AdobeFireflyExecutor extends BaseExecutor {
  constructor() {
    super("adobe-firefly", { id: "adobe-firefly", baseUrl: ADOBE_FIREFLY_BASE_URL });
  }

  async execute(_input: ExecuteInput) {
    return makeExecutorErrorResult(
      400,
      "adobe-firefly is a media-generation provider and does not support chat completions. " +
        "Use POST /v1/images/generations or /v1/images/edits (e.g. model \"adobe-firefly/nano-banana-pro\") " +
        "or POST /v1/videos/generations (e.g. model \"adobe-firefly/sora-2\").",
      _input.body,
      ADOBE_FIREFLY_BASE_URL
    );
  }
}

export default AdobeFireflyExecutor;