UNPKG

@botpress/adk-cli

Version:

Command-line interface for the Botpress Agent Development Kit (ADK)

4,193 lines 142 kB
// @bun
import {
  axios_default
} from "./chunk-w346ejn9.js";

// ../../node_modules/.bun/@botpress+cognitive@0.6.1/node_modules/@botpress/cognitive/dist/index.mjs
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
var require_options = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/options.js"(exports) {
    var __assign = exports && exports.__assign || function() {
      __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length;i < n; i++) {
          s = arguments[i];
          for (var p in s)
            if (Object.prototype.hasOwnProperty.call(s, p))
              t[p] = s[p];
        }
        return t;
      };
      return __assign.apply(this, arguments);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    var defaultOptions = {
      delayFirstAttempt: false,
      jitter: "none",
      maxDelay: Infinity,
      numOfAttempts: 10,
      retry: function() {
        return true;
      },
      startingDelay: 100,
      timeMultiple: 2
    };
    function getSanitizedOptions(options) {
      var sanitized = __assign(__assign({}, defaultOptions), options);
      if (sanitized.numOfAttempts < 1) {
        sanitized.numOfAttempts = 1;
      }
      return sanitized;
    }
    exports.getSanitizedOptions = getSanitizedOptions;
  }
});
var require_full_jitter = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js"(exports) {
    Object.defineProperty(exports, "__esModule", { value: true });
    function fullJitter(delay) {
      var jitteredDelay = Math.random() * delay;
      return Math.round(jitteredDelay);
    }
    exports.fullJitter = fullJitter;
  }
});
var require_no_jitter = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js"(exports) {
    Object.defineProperty(exports, "__esModule", { value: true });
    function noJitter(delay) {
      return delay;
    }
    exports.noJitter = noJitter;
  }
});
var require_jitter_factory = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/jitter/jitter.factory.js"(exports) {
    Object.defineProperty(exports, "__esModule", { value: true });
    var full_jitter_1 = require_full_jitter();
    var no_jitter_1 = require_no_jitter();
    function JitterFactory(options) {
      switch (options.jitter) {
        case "full":
          return full_jitter_1.fullJitter;
        case "none":
        default:
          return no_jitter_1.noJitter;
      }
    }
    exports.JitterFactory = JitterFactory;
  }
});
var require_delay_base = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/delay/delay.base.js"(exports) {
    Object.defineProperty(exports, "__esModule", { value: true });
    var jitter_factory_1 = require_jitter_factory();
    var Delay = function() {
      function Delay2(options) {
        this.options = options;
        this.attempt = 0;
      }
      Delay2.prototype.apply = function() {
        var _this = this;
        return new Promise(function(resolve) {
          return setTimeout(resolve, _this.jitteredDelay);
        });
      };
      Delay2.prototype.setAttemptNumber = function(attempt) {
        this.attempt = attempt;
      };
      Object.defineProperty(Delay2.prototype, "jitteredDelay", {
        get: function() {
          var jitter = jitter_factory_1.JitterFactory(this.options);
          return jitter(this.delay);
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(Delay2.prototype, "delay", {
        get: function() {
          var constant = this.options.startingDelay;
          var base = this.options.timeMultiple;
          var power = this.numOfDelayedAttempts;
          var delay = constant * Math.pow(base, power);
          return Math.min(delay, this.options.maxDelay);
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(Delay2.prototype, "numOfDelayedAttempts", {
        get: function() {
          return this.attempt;
        },
        enumerable: true,
        configurable: true
      });
      return Delay2;
    }();
    exports.Delay = Delay;
  }
});
var require_skip_first_delay = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js"(exports) {
    var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d, b) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
          d2.__proto__ = b2;
        } || function(d2, b2) {
          for (var p in b2)
            if (b2.hasOwnProperty(p))
              d2[p] = b2[p];
        };
        return extendStatics(d, b);
      };
      return function(d, b) {
        extendStatics(d, b);
        function __() {
          this.constructor = d;
        }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __);
      };
    }();
    var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
      function adopt(value) {
        return value instanceof P ? value : new P(function(resolve) {
          resolve(value);
        });
      }
      return new (P || (P = Promise))(function(resolve, reject) {
        function fulfilled(value) {
          try {
            step(generator.next(value));
          } catch (e) {
            reject(e);
          }
        }
        function rejected(value) {
          try {
            step(generator["throw"](value));
          } catch (e) {
            reject(e);
          }
        }
        function step(result) {
          result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
    };
    var __generator = exports && exports.__generator || function(thisArg, body) {
      var _ = { label: 0, sent: function() {
        if (t[0] & 1)
          throw t[1];
        return t[1];
      }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), throw: verb(1), return: verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
        return this;
      }), g;
      function verb(n) {
        return function(v) {
          return step([n, v]);
        };
      }
      function step(op) {
        if (f)
          throw new TypeError("Generator is already executing.");
        while (_)
          try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
              return t;
            if (y = 0, t)
              op = [op[0] & 2, t.value];
            switch (op[0]) {
              case 0:
              case 1:
                t = op;
                break;
              case 4:
                _.label++;
                return { value: op[1], done: false };
              case 5:
                _.label++;
                y = op[1];
                op = [0];
                continue;
              case 7:
                op = _.ops.pop();
                _.trys.pop();
                continue;
              default:
                if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                  _ = 0;
                  continue;
                }
                if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                  _.label = op[1];
                  break;
                }
                if (op[0] === 6 && _.label < t[1]) {
                  _.label = t[1];
                  t = op;
                  break;
                }
                if (t && _.label < t[2]) {
                  _.label = t[2];
                  _.ops.push(op);
                  break;
                }
                if (t[2])
                  _.ops.pop();
                _.trys.pop();
                continue;
            }
            op = body.call(thisArg, _);
          } catch (e) {
            op = [6, e];
            y = 0;
          } finally {
            f = t = 0;
          }
        if (op[0] & 5)
          throw op[1];
        return { value: op[0] ? op[1] : undefined, done: true };
      }
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    var delay_base_1 = require_delay_base();
    var SkipFirstDelay = function(_super) {
      __extends(SkipFirstDelay2, _super);
      function SkipFirstDelay2() {
        return _super !== null && _super.apply(this, arguments) || this;
      }
      SkipFirstDelay2.prototype.apply = function() {
        return __awaiter(this, undefined, undefined, function() {
          return __generator(this, function(_a) {
            return [2, this.isFirstAttempt ? true : _super.prototype.apply.call(this)];
          });
        });
      };
      Object.defineProperty(SkipFirstDelay2.prototype, "isFirstAttempt", {
        get: function() {
          return this.attempt === 0;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(SkipFirstDelay2.prototype, "numOfDelayedAttempts", {
        get: function() {
          return this.attempt - 1;
        },
        enumerable: true,
        configurable: true
      });
      return SkipFirstDelay2;
    }(delay_base_1.Delay);
    exports.SkipFirstDelay = SkipFirstDelay;
  }
});
var require_always_delay = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/delay/always/always.delay.js"(exports) {
    var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
      var extendStatics = function(d, b) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
          d2.__proto__ = b2;
        } || function(d2, b2) {
          for (var p in b2)
            if (b2.hasOwnProperty(p))
              d2[p] = b2[p];
        };
        return extendStatics(d, b);
      };
      return function(d, b) {
        extendStatics(d, b);
        function __() {
          this.constructor = d;
        }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __);
      };
    }();
    Object.defineProperty(exports, "__esModule", { value: true });
    var delay_base_1 = require_delay_base();
    var AlwaysDelay = function(_super) {
      __extends(AlwaysDelay2, _super);
      function AlwaysDelay2() {
        return _super !== null && _super.apply(this, arguments) || this;
      }
      return AlwaysDelay2;
    }(delay_base_1.Delay);
    exports.AlwaysDelay = AlwaysDelay;
  }
});
var require_delay_factory = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/delay/delay.factory.js"(exports) {
    Object.defineProperty(exports, "__esModule", { value: true });
    var skip_first_delay_1 = require_skip_first_delay();
    var always_delay_1 = require_always_delay();
    function DelayFactory(options, attempt) {
      var delay = initDelayClass(options);
      delay.setAttemptNumber(attempt);
      return delay;
    }
    exports.DelayFactory = DelayFactory;
    function initDelayClass(options) {
      if (!options.delayFirstAttempt) {
        return new skip_first_delay_1.SkipFirstDelay(options);
      }
      return new always_delay_1.AlwaysDelay(options);
    }
  }
});
var require_backoff = __commonJS({
  "../../node_modules/.pnpm/exponential-backoff@3.1.1/node_modules/exponential-backoff/dist/backoff.js"(exports) {
    var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
      function adopt(value) {
        return value instanceof P ? value : new P(function(resolve) {
          resolve(value);
        });
      }
      return new (P || (P = Promise))(function(resolve, reject) {
        function fulfilled(value) {
          try {
            step(generator.next(value));
          } catch (e) {
            reject(e);
          }
        }
        function rejected(value) {
          try {
            step(generator["throw"](value));
          } catch (e) {
            reject(e);
          }
        }
        function step(result) {
          result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
        }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
    };
    var __generator = exports && exports.__generator || function(thisArg, body) {
      var _ = { label: 0, sent: function() {
        if (t[0] & 1)
          throw t[1];
        return t[1];
      }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), throw: verb(1), return: verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
        return this;
      }), g;
      function verb(n) {
        return function(v) {
          return step([n, v]);
        };
      }
      function step(op) {
        if (f)
          throw new TypeError("Generator is already executing.");
        while (_)
          try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
              return t;
            if (y = 0, t)
              op = [op[0] & 2, t.value];
            switch (op[0]) {
              case 0:
              case 1:
                t = op;
                break;
              case 4:
                _.label++;
                return { value: op[1], done: false };
              case 5:
                _.label++;
                y = op[1];
                op = [0];
                continue;
              case 7:
                op = _.ops.pop();
                _.trys.pop();
                continue;
              default:
                if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                  _ = 0;
                  continue;
                }
                if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                  _.label = op[1];
                  break;
                }
                if (op[0] === 6 && _.label < t[1]) {
                  _.label = t[1];
                  t = op;
                  break;
                }
                if (t && _.label < t[2]) {
                  _.label = t[2];
                  _.ops.push(op);
                  break;
                }
                if (t[2])
                  _.ops.pop();
                _.trys.pop();
                continue;
            }
            op = body.call(thisArg, _);
          } catch (e) {
            op = [6, e];
            y = 0;
          } finally {
            f = t = 0;
          }
        if (op[0] & 5)
          throw op[1];
        return { value: op[0] ? op[1] : undefined, done: true };
      }
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    var options_1 = require_options();
    var delay_factory_1 = require_delay_factory();
    function backOff3(request, options) {
      if (options === undefined) {
        options = {};
      }
      return __awaiter(this, undefined, undefined, function() {
        var sanitizedOptions, backOff4;
        return __generator(this, function(_a) {
          switch (_a.label) {
            case 0:
              sanitizedOptions = options_1.getSanitizedOptions(options);
              backOff4 = new BackOff(request, sanitizedOptions);
              return [4, backOff4.execute()];
            case 1:
              return [2, _a.sent()];
          }
        });
      });
    }
    exports.backOff = backOff3;
    var BackOff = function() {
      function BackOff2(request, options) {
        this.request = request;
        this.options = options;
        this.attemptNumber = 0;
      }
      BackOff2.prototype.execute = function() {
        return __awaiter(this, undefined, undefined, function() {
          var e_1, shouldRetry;
          return __generator(this, function(_a) {
            switch (_a.label) {
              case 0:
                if (!!this.attemptLimitReached)
                  return [3, 7];
                _a.label = 1;
              case 1:
                _a.trys.push([1, 4, , 6]);
                return [4, this.applyDelay()];
              case 2:
                _a.sent();
                return [4, this.request()];
              case 3:
                return [2, _a.sent()];
              case 4:
                e_1 = _a.sent();
                this.attemptNumber++;
                return [4, this.options.retry(e_1, this.attemptNumber)];
              case 5:
                shouldRetry = _a.sent();
                if (!shouldRetry || this.attemptLimitReached) {
                  throw e_1;
                }
                return [3, 6];
              case 6:
                return [3, 0];
              case 7:
                throw new Error("Something went wrong.");
            }
          });
        });
      };
      Object.defineProperty(BackOff2.prototype, "attemptLimitReached", {
        get: function() {
          return this.attemptNumber >= this.options.numOfAttempts;
        },
        enumerable: true,
        configurable: true
      });
      BackOff2.prototype.applyDelay = function() {
        return __awaiter(this, undefined, undefined, function() {
          var delay;
          return __generator(this, function(_a) {
            switch (_a.label) {
              case 0:
                delay = delay_factory_1.DelayFactory(this.options, this.attemptNumber);
                return [4, delay.apply()];
              case 1:
                _a.sent();
                return [
                  2
                ];
            }
          });
        });
      };
      return BackOff2;
    }();
  }
});
var import_exponential_backoff2 = __toESM(require_backoff());
var createNanoEvents = () => ({
  emit(event, ...args) {
    for (let callbacks = this.events[event] || [], i = 0, length = callbacks.length;i < length; i++) {
      callbacks[i](...args);
    }
  },
  events: {},
  on(event, cb) {
    (this.events[event] ||= []).push(cb);
    return () => {
      this.events[event] = this.events[event]?.filter((i) => cb !== i);
    };
  }
});
var getExtendedClient = (_client) => {
  const client = _client;
  if (!client || client === null || typeof client !== "object") {
    throw new Error("Client must be a valid instance of a Botpress client (@botpress/client)");
  }
  if (typeof client._client === "object" && !!client._client) {
    try {
      return getExtendedClient(client._client);
    } catch {}
  }
  if (typeof client.constructor !== "function" || typeof client.callAction !== "function" || !client.config || typeof client.config !== "object" || !client.config.headers) {
    throw new Error("Client must be a valid instance of a Botpress client (@botpress/client)");
  }
  const clone = () => {
    const c = client;
    if (c.clone && typeof c.clone === "function") {
      return getExtendedClient(c.clone());
    }
    return getExtendedClient(new c.constructor(c.config));
  };
  return {
    ...client,
    botId: client.config.headers["x-bot-id"],
    axios: client.axiosInstance,
    clone,
    abortable: (signal) => {
      const abortable = clone();
      const instance = abortable.axios;
      instance.defaults.signal = signal;
      return abortable;
    }
  };
};
var import_exponential_backoff = __toESM(require_backoff());
var models = {
  "openai:gpt-5.5": {
    id: "openai:gpt-5.5",
    name: "GPT-5.5",
    description: `GPT-5.5 is OpenAI's latest frontier model, described as "a new class of intelligence for coding and professional work". It features a 1M+ context window with adaptive reasoning and configurable effort levels, and supports vision, tool use, structured outputs, and server-side web search.`,
    input: {
      maxTokens: 1047576,
      costPer1MTokens: 5
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 30
    },
    tags: ["recommended", "reasoning", "general-purpose", "vision", "coding", "agents"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "openai:gpt-5.4-2026-03-05": {
    id: "openai:gpt-5.4-2026-03-05",
    name: "GPT-5.4",
    description: "GPT-5.4 is the latest frontier model in the GPT-5 series, featuring a 1M+ context window and adaptive reasoning. It delivers state-of-the-art performance on professional knowledge work, coding, and agentic tasks with improved long-context understanding.",
    input: {
      maxTokens: 1047576,
      costPer1MTokens: 2.5
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 15
    },
    tags: ["recommended", "reasoning", "general-purpose", "vision", "coding", "agents"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    },
    aliases: ["gpt-5.4"]
  },
  "openai:gpt-5.4-mini-2026-03-17": {
    id: "openai:gpt-5.4-mini-2026-03-17",
    name: "GPT-5.4 Mini",
    description: "GPT-5.4 Mini brings the strengths of GPT-5.4 to a faster, more efficient model designed for high-volume workloads. It is optimized for speed and cost while retaining strong reasoning and vision capabilities.",
    input: {
      maxTokens: 400000,
      costPer1MTokens: 0.75
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 4.5
    },
    tags: ["recommended", "reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-5.4-mini"]
  },
  "openai:gpt-5.4-nano-2026-03-17": {
    id: "openai:gpt-5.4-nano-2026-03-17",
    name: "GPT-5.4 Nano",
    description: "GPT-5.4 Nano is the smallest and cheapest GPT-5.4 variant, designed for tasks where speed and cost matter most like classification, data extraction, ranking, and coding sub-agents.",
    input: {
      maxTokens: 400000,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 1.25
    },
    tags: ["low-cost", "reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-5.4-nano"]
  },
  "openai:gpt-5.3-chat": {
    id: "openai:gpt-5.3-chat",
    name: "GPT-5.3 Chat",
    description: "GPT-5.3 Chat is the GPT-5.3 Instant model used in ChatGPT, exposed via the API. Rolling alias that points to the latest snapshot.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 1.75
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 14
    },
    tags: ["reasoning", "general-purpose", "vision"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-5.3-chat-latest"]
  },
  "openai:gpt-5.2-2025-12-11": {
    id: "openai:gpt-5.2-2025-12-11",
    name: "GPT-5.2",
    description: "GPT-5.2 is the latest frontier-grade model in the GPT-5 series, offering stronger agentic and long context perfomance compared to GPT-5.1. It uses adaptive reasoning to allocate computation dynamically, responding quickly to simple queries while spending more depth on complex tasks.",
    input: {
      maxTokens: 400000,
      costPer1MTokens: 1.75
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 14
    },
    tags: ["recommended", "reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "openai:gpt-5.1-2025-11-13": {
    id: "openai:gpt-5.1-2025-11-13",
    name: "GPT-5.1",
    description: "GPT-5.1 is OpenAI's latest and most advanced AI model. It is a reasoning model that chooses the best way to respond based on task complexity and user intent. GPT-5.1 delivers expert-level performance across coding, math, writing, health, and visual perception, with improved accuracy, speed, and reduced hallucinations. It excels in complex tasks, long-context understanding, multimodal inputs (text and images), and safe, nuanced responses.",
    input: {
      maxTokens: 400000,
      costPer1MTokens: 1.25
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 10
    },
    tags: ["recommended", "reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "openai:gpt-5-2025-08-07": {
    id: "openai:gpt-5-2025-08-07",
    name: "GPT-5",
    description: "GPT-5 is a reasoning model that chooses the best way to respond based on task complexity and user intent. GPT-5 delivers expert-level performance across coding, math, writing, health, and visual perception, with improved accuracy, speed, and reduced hallucinations. It excels in complex tasks, long-context understanding, multimodal inputs (text and images), and safe, nuanced responses.",
    input: {
      maxTokens: 400000,
      costPer1MTokens: 1.25
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 10
    },
    tags: ["reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-5"]
  },
  "openai:gpt-5-mini-2025-08-07": {
    id: "openai:gpt-5-mini-2025-08-07",
    name: "GPT-5 Mini",
    description: "GPT-5 Mini is a lightweight and cost-effective version of GPT-5, optimized for applications where speed and efficiency matter more than full advanced capabilities. It is designed for cost-sensitive use cases such as chatbots, content generation, and high-volume usage, striking a balance between performance and affordability, making it suitable for simpler tasks that do not require deep multi-step reasoning or the full reasoning power of GPT-5",
    input: {
      maxTokens: 400000,
      costPer1MTokens: 0.25
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 2
    },
    tags: ["recommended", "reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-5-mini"]
  },
  "openai:gpt-5-nano-2025-08-07": {
    id: "openai:gpt-5-nano-2025-08-07",
    name: "GPT-5 Nano",
    description: "GPT-5 Nano is an ultra-lightweight version of GPT-5 optimized for speed and very low latency, making it ideal for use cases like simple chatbots, basic content generation, summarization, and classification tasks.",
    input: {
      maxTokens: 400000,
      costPer1MTokens: 0.05
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 0.4
    },
    tags: ["low-cost", "reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-5-nano"]
  },
  "openai:o4-mini-2025-04-16": {
    id: "openai:o4-mini-2025-04-16",
    name: "GPT o4-mini",
    description: "o4-mini is OpenAI's latest small o-series model. It's optimized for fast, effective reasoning with exceptionally efficient performance in coding and visual tasks.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 1.1
    },
    output: {
      maxTokens: 1e5,
      costPer1MTokens: 4.4
    },
    tags: ["reasoning", "vision", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["o4-mini"]
  },
  "openai:o3-2025-04-16": {
    id: "openai:o3-2025-04-16",
    name: "GPT o3",
    description: "o3 is a well-rounded and powerful model across domains. It sets a new standard for math, science, coding, and visual reasoning tasks. It also excels at technical writing and instruction-following.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 2
    },
    output: {
      maxTokens: 1e5,
      costPer1MTokens: 8
    },
    tags: ["reasoning", "vision", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["o3"]
  },
  "openai:gpt-4.1-2025-04-14": {
    id: "openai:gpt-4.1-2025-04-14",
    name: "GPT 4.1",
    description: "GPT 4.1 is a model suited for complex tasks and problem solving across domains. The knowledge cutoff is June 2024.",
    input: {
      maxTokens: 1047576,
      costPer1MTokens: 2
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 8
    },
    tags: ["recommended", "vision", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-4.1"]
  },
  "openai:gpt-4.1-mini-2025-04-14": {
    id: "openai:gpt-4.1-mini-2025-04-14",
    name: "GPT 4.1 Mini",
    description: "GPT 4.1 mini provides a balance between intelligence, speed, and cost that makes it an attractive model for many use cases. The knowledge cutoff is June 2024.",
    input: {
      maxTokens: 1047576,
      costPer1MTokens: 0.4
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 1.6
    },
    tags: ["recommended", "vision", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-4.1-mini"]
  },
  "openai:gpt-4.1-nano-2025-04-14": {
    id: "openai:gpt-4.1-nano-2025-04-14",
    name: "GPT 4.1 Nano",
    description: "GPT-4.1 nano is the fastest, most cost-effective GPT 4.1 model. The knowledge cutoff is June 2024.",
    input: {
      maxTokens: 1047576,
      costPer1MTokens: 0.1
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 0.4
    },
    tags: ["deprecated", "low-cost", "vision", "general-purpose"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-4.1-nano"]
  },
  "openai:o3-mini-2025-01-31": {
    id: "openai:o3-mini-2025-01-31",
    name: "GPT o3-mini",
    description: "o3-mini is a small reasoning model, providing high intelligence at the same cost and latency targets of o1-mini. Also supports key developer features like Structured Outputs and function calling.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 1.1
    },
    output: {
      maxTokens: 1e5,
      costPer1MTokens: 4.4
    },
    tags: ["deprecated", "reasoning", "general-purpose", "coding"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["o3-mini"]
  },
  "openai:o1-2024-12-17": {
    id: "openai:o1-2024-12-17",
    name: "GPT o1",
    description: "The o1 model is designed to solve hard problems across domains. Trained with reinforcement learning to perform complex reasoning with a long internal chain of thought.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 15
    },
    output: {
      maxTokens: 1e5,
      costPer1MTokens: 60
    },
    tags: ["deprecated", "reasoning", "vision", "general-purpose"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:o1-mini-2024-09-12": {
    id: "openai:o1-mini-2024-09-12",
    name: "GPT o1-mini",
    description: "The o1-mini model is a fast and affordable reasoning model for specialized tasks. Trained with reinforcement learning to perform complex reasoning.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 1.1
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 4.4
    },
    tags: ["reasoning", "vision", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["o1-mini"]
  },
  "openai:gpt-4o-mini-2024-07-18": {
    id: "openai:gpt-4o-mini-2024-07-18",
    name: "GPT-4o Mini",
    description: "GPT-4o mini is an advanced model in the small models category, and their cheapest model yet. Multimodal with higher intelligence than gpt-3.5-turbo but just as fast.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.15
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.6
    },
    tags: ["recommended", "vision", "low-cost", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-4o-mini"]
  },
  "openai:gpt-4o-2024-11-20": {
    id: "openai:gpt-4o-2024-11-20",
    name: "GPT-4o (November 2024)",
    description: "GPT-4o is an advanced multimodal model with the same high intelligence as GPT-4 Turbo but cheaper and more efficient.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 2.5
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 10
    },
    tags: ["recommended", "vision", "general-purpose", "coding", "agents"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["gpt-4o"]
  },
  "openai:gpt-4o-2024-08-06": {
    id: "openai:gpt-4o-2024-08-06",
    name: "GPT-4o (August 2024)",
    description: "GPT-4o is an advanced multimodal model with the same high intelligence as GPT-4 Turbo but cheaper and more efficient.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 2.5
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 10
    },
    tags: ["deprecated", "vision", "general-purpose", "coding", "agents"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-4o-2024-05-13": {
    id: "openai:gpt-4o-2024-05-13",
    name: "GPT-4o (May 2024)",
    description: "GPT-4o is an advanced multimodal model with the same high intelligence as GPT-4 Turbo but cheaper and more efficient.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 5
    },
    output: {
      maxTokens: 4096,
      costPer1MTokens: 15
    },
    tags: ["deprecated", "vision", "general-purpose", "coding", "agents"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-4-turbo-2024-04-09": {
    id: "openai:gpt-4-turbo-2024-04-09",
    name: "GPT-4 Turbo",
    description: "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy than previous models, thanks to its broader general knowledge and advanced reasoning capabilities.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 10
    },
    output: {
      maxTokens: 4096,
      costPer1MTokens: 30
    },
    tags: ["deprecated", "general-purpose", "coding", "agents"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-3.5-turbo-0125": {
    id: "openai:gpt-3.5-turbo-0125",
    name: "GPT-3.5 Turbo",
    description: "GPT-3.5 Turbo can understand and generate natural language or code and has been optimized for chat but works well for non-chat tasks as well.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.5
    },
    output: {
      maxTokens: 4096,
      costPer1MTokens: 1.5
    },
    tags: ["deprecated", "general-purpose", "low-cost"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:whisper-1": {
    id: "openai:whisper-1",
    name: "Whisper V2",
    description: "OpenAI Whisper V2 \u2014 general-purpose speech recognition model supporting 99 languages.",
    input: {
      maxTokens: 0,
      costPer1MTokens: 0,
      costPerMinute: 0.006
    },
    output: {
      maxTokens: 0,
      costPer1MTokens: 0
    },
    tags: ["general-purpose", "speech-to-text"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: true,
      supportsSearch: false
    }
  },
  "openai:tts-1": {
    id: "openai:tts-1",
    name: "OpenAI TTS-1",
    description: "Standard text-to-speech, low latency",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:tts-1-hd": {
    id: "openai:tts-1-hd",
    name: "OpenAI TTS-1 HD",
    description: "High-definition text-to-speech",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-4o-mini-tts": {
    id: "openai:gpt-4o-mini-tts",
    name: "GPT-4o Mini TTS",
    description: "Steerable text-to-speech with voice instructions",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-image-2": {
    id: "openai:gpt-image-2",
    name: "OpenAI gpt-image-2",
    description: "OpenAI's newest native multimodal image generation model. Highest quality, accepts input images for editing.",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-image-1.5": {
    id: "openai:gpt-image-1.5",
    name: "OpenAI gpt-image-1.5",
    description: "Flagship native multimodal image generation. Strong text rendering, accepts input images for editing.",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-image-1-mini": {
    id: "openai:gpt-image-1-mini",
    name: "OpenAI gpt-image-1-mini",
    description: "Affordable variant of gpt-image-1.5 for high-volume, cost-sensitive image generation.",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openai:gpt-image-1": {
    id: "openai:gpt-image-1",
    name: "OpenAI gpt-image-1",
    description: "Original OpenAI native multimodal image generation model. Superseded by gpt-image-1.5 / gpt-image-2.",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "anthropic:claude-opus-4-7": {
    id: "anthropic:claude-opus-4-7",
    name: "Claude Opus 4.7",
    description: "Claude Opus 4.7 is Anthropic's most capable generally available model, with a step-change improvement in agentic coding over Claude Opus 4.6. Features adaptive thinking for dynamic reasoning allocation, substantially improved vision capabilities, and task budgets for agentic loops. Uses a new tokenizer that may use up to 35% more tokens for the same text.",
    input: {
      maxTokens: 1e6,
      costPer1MTokens: 5
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 25
    },
    tags: ["recommended", "reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "anthropic:claude-opus-4-6": {
    id: "anthropic:claude-opus-4-6",
    name: "Claude Opus 4.6",
    description: "Claude Opus 4.6 is the most intelligent Claude model, built for complex agents and coding workflows. It excels at long-running professional tasks, large codebases, complex refactors, and multi-step debugging with a 128K max output.",
    input: {
      maxTokens: 1e6,
      costPer1MTokens: 5
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 25
    },
    tags: ["recommended", "reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "anthropic:claude-sonnet-4-6": {
    id: "anthropic:claude-sonnet-4-6",
    name: "Claude Sonnet 4.6",
    description: "Claude Sonnet 4.6 offers the best combination of speed and intelligence in the Claude family. It features adaptive thinking for dynamic reasoning allocation, delivering fast responses for simple queries and deeper analysis for complex tasks.",
    input: {
      maxTokens: 1e6,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 15
    },
    tags: ["recommended", "reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "anthropic:claude-opus-4-5-20251101": {
    id: "anthropic:claude-opus-4-5-20251101",
    name: "Claude Opus 4.5",
    description: "Claude Opus 4.5 is a highly capable model with strong reasoning, coding, and agentic performance. It offers the same pricing tier as Opus 4.6 with a 200K context window.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 5
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 25
    },
    tags: ["reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    },
    aliases: ["claude-opus-4-5"]
  },
  "anthropic:claude-sonnet-4-5-20250929": {
    id: "anthropic:claude-sonnet-4-5-20250929",
    name: "Claude Sonnet 4.5",
    description: "Claude Sonnet 4.5 is Anthropic's most advanced Sonnet model to date, optimized for real-world agents and coding workflows. It delivers state-of-the-art performance on coding benchmarks, with improvements across system design, code security, and specification adherence.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 15
    },
    tags: ["recommended", "reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: true
    },
    aliases: ["claude-sonnet-4-5"]
  },
  "anthropic:claude-sonnet-4-20250514": {
    id: "anthropic:claude-sonnet-4-20250514",
    name: "Claude Sonnet 4",
    description: "Claude Sonnet 4 significantly enhances the capabilities of its predecessor, Sonnet 3.7, excelling in both coding and reasoning tasks with improved precision and controllability. Sonnet 4 balances capability and computational efficiency, making it suitable for a broad range of applications from routine coding tasks to complex software development projects. Key enhancements include improved autonomous codebase navigation, reduced error rates in agent-driven workflows, and increased reliability in following intricate instructions.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 15
    },
    tags: ["recommended", "reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["claude-sonnet-4"]
  },
  "anthropic:claude-sonnet-4-reasoning-20250514": {
    id: "anthropic:claude-sonnet-4-reasoning-20250514",
    name: "Claude Sonnet 4 (Reasoning Mode)",
    description: `This model uses the "Extended Thinking" mode and will use a significantly higher amount of output tokens than the Standard Mode, so this model should only be used for tasks that actually require it.

Claude Sonnet 4 significantly enhances the capabilities of its predecessor, Sonnet 3.7, excelling in both coding and reasoning tasks with improved precision and controllability.`,
    input: {
      maxTokens: 200000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 15
    },
    tags: ["deprecated", "vision", "reasoning", "general-purpose", "agents", "coding"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["claude-sonnet-4-reasoning"]
  },
  "anthropic:claude-haiku-4-5-20251001": {
    id: "anthropic:claude-haiku-4-5-20251001",
    name: "Claude Haiku 4.5",
    description: "Claude Haiku 4.5 is Anthropic's fastest and most efficient model, delivering near-frontier intelligence at a fraction of the cost and latency of larger Claude models. Matching Claude Sonnet 4's performance across reasoning, coding, and computer-use tasks, Haiku 4.5 brings frontier-level capability to real-time and high-volume applications.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 1
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 5
    },
    tags: ["recommended", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["claude-haiku-4-5"]
  },
  "anthropic:claude-haiku-4-5-reasoning-20251001": {
    id: "anthropic:claude-haiku-4-5-reasoning-20251001",
    name: "Claude Haiku 4.5 (Reasoning Mode)",
    description: `This model uses the "Extended Thinking" mode and will use a significantly higher amount of output tokens than the Standard Mode, so this model should only be used for tasks that actually require it.

Claude Haiku 4.5 is Anthropic's fastest and most efficient model, delivering near-frontier intelligence at a fraction of the cost and latency of larger Claude models. Matching Claude Sonnet 4's performance across reasoning, coding, and computer-use tasks, Haiku 4.5 brings frontier-level capability to real-time and high-volume applications.`,
    input: {
      maxTokens: 200000,
      costPer1MTokens: 1
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 5
    },
    tags: ["recommended", "reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["claude-haiku-4-5-reasoning", "claude-haiku-4-5-20251001"]
  },
  "anthropic:claude-3-7-sonnet-20250219": {
    id: "anthropic:claude-3-7-sonnet-20250219",
    name: "Claude 3.7 Sonnet",
    description: "Claude 3.7 Sonnet is an advanced large language model with improved reasoning, coding, and problem-solving capabilities. The model demonstrates notable improvements in coding, particularly in front-end development and full-stack updates, and excels in agentic workflows, where it can autonomously navigate multi-step processes.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 15
    },
    tags: ["recommended", "reasoning", "agents", "vision", "general-purpose", "coding"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "anthropic:claude-3-7-sonnet-reasoning-20250219": {
    id: "anthropic:claude-3-7-sonnet-reasoning-20250219",
    name: "Claude 3.7 Sonnet (Reasoning Mode)",
    description: `This model uses the "Extended Thinking" mode and will use a significantly higher amount of output tokens than the Standard Mode, so this model should only be used for tasks that actually require it.

Claude 3.7 Sonnet is an advanced large language model with improved reasoning, coding, and problem-solving capabilities.`,
    input: {
      maxTokens: 200000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 64000,
      costPer1MTokens: 15
    },
    tags: ["deprecated", "vision", "reasoning", "general-purpose", "agents", "coding"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "anthropic:claude-3-5-haiku-20241022": {
    id: "anthropic:claude-3-5-haiku-20241022",
    name: "Claude 3.5 Haiku",
    description: "Claude 3.5 Haiku features offers enhanced capabilities in speed, coding accuracy, and tool use. Engineered to excel in real-time applications, it delivers quick response times that are essential for dynamic tasks such as chat interactions and immediate coding suggestions.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 0.8
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 4
    },
    tags: ["general-purpose", "low-cost"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "anthropic:claude-3-5-sonnet-20241022": {
    id: "anthropic:claude-3-5-sonnet-20241022",
    name: "Claude 3.5 Sonnet (October 2024)",
    description: "Claude 3.5 Sonnet delivers better-than-Opus capabilities, faster-than-Sonnet speeds, at the same Sonnet prices. Sonnet is particularly good at coding, data science, visual processing, and agentic tasks.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 15
    },
    tags: ["vision", "general-purpose", "agents", "coding", "storytelling"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "anthropic:claude-3-5-sonnet-20240620": {
    id: "anthropic:claude-3-5-sonnet-20240620",
    name: "Claude 3.5 Sonnet (June 2024)",
    description: "Claude 3.5 Sonnet delivers better-than-Opus capabilities, faster-than-Sonnet speeds, at the same Sonnet prices. Sonnet is particularly good at coding, data science, visual processing, and agentic tasks.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 4096,
      costPer1MTokens: 15
    },
    tags: ["vision", "general-purpose", "agents", "coding", "storytelling"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "anthropic:claude-3-haiku-20240307": {
    id: "anthropic:claude-3-haiku-20240307",
    name: "Claude 3 Haiku",
    description: "Claude 3 Haiku is Anthropic's fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.",
    input: {
      maxTokens: 200000,
      costPer1MTokens: 0.25
    },
    output: {
      maxTokens: 4096,
      costPer1MTokens: 1.25
    },
    tags: ["deprecated", "low-cost", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "google-ai:gemini-3.1-pro": {
    id: "google-ai:gemini-3.1-pro",
    name: "Gemini 3.1 Pro",
    description: "Google's most powerful agentic and coding model, delivering state-of-the-art reasoning with rich multimodal understanding. Successor to Gemini 3 Pro (shut down March 9, 2026).",
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 2
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 12
    },
    tags: ["reasoning", "agents", "general-purpose", "vision", "coding"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: true
    },
    aliases: ["gemini-3.1-pro-preview"]
  },
  "google-ai:gemini-3-flash": {
    id: "google-ai:gemini-3-flash",
    name: "Gemini 3 Flash",
    description: "Google's most balanced model built for speed, scale, and frontier intelligence.",
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 0.5
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 3
    },
    tags: ["reasoning", "agents", "general-purpose", "vision"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: true
    },
    aliases: ["gemini-3-flash-preview"]
  },
  "google-ai:gemini-3.1-flash-lite": {
    id: "google-ai:gemini-3.1-flash-lite",
    name: "Gemini 3.1 Flash-Lite",
    description: "Google's most cost-effective AI model for high-volume, low-latency tasks. Offers strong performance at a fraction of the cost of larger models.",
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 0.25
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 1.5
    },
    tags: ["low-cost", "general-purpose", "vision"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: true
    },
    aliases: ["gemini-3.1-flash-lite-preview"]
  },
  "google-ai:gemini-2.5-pro": {
    id: "google-ai:gemini-2.5-pro",
    name: "Gemini 2.5 Pro",
    description: `Google's most advanced stable AI model designed for complex reasoning, coding, mathematics, and scientific tasks. Features "thinking" capabilities for superior human-preference alignment and problem-solving.`,
    input: {
      maxTokens: 200000,
      costPer1MTokens: 1.25
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 10
    },
    tags: ["recommended", "reasoning", "agents", "general-purpose", "vision", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "google-ai:gemini-2.5-flash": {
    id: "google-ai:gemini-2.5-flash",
    name: "Gemini 2.5 Flash",
    description: `Google's state-of-the-art workhorse model with advanced reasoning, coding, mathematics, and scientific capabilities. Includes built-in "thinking" capabilities for enhanced accuracy.`,
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 0.3
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 2.5
    },
    tags: ["recommended", "reasoning", "agents", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "google-ai:gemini-2.5-flash-lite": {
    id: "google-ai:gemini-2.5-flash-lite",
    name: "Gemini 2.5 Flash-Lite",
    description: "Lightweight, cost-efficient Gemini model optimized for high-volume, low-latency tasks. Successor to Gemini 2.0 Flash with improved capabilities.",
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 0.1
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 0.4
    },
    tags: ["recommended", "low-cost", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: true
    }
  },
  "google-ai:gemini-2.0-flash": {
    id: "google-ai:gemini-2.0-flash",
    name: "Gemini 2.0 Flash",
    description: "Next-gen Gemini model with improved capabilities, superior speed, native tool use, multimodal generation, and 1M token context window.",
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 0.1
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.4
    },
    tags: ["low-cost", "general-purpose", "vision"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["models/gemini-2.0-flash"]
  },
  "google-ai:gemini-3-pro": {
    id: "google-ai:gemini-3-pro",
    name: "Gemini 3 Pro (Shut Down)",
    description: "Gemini 3 Pro Preview was shut down on March 9, 2026. Use Gemini 3.1 Pro instead.",
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 2
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 12
    },
    tags: ["reasoning", "agents", "general-purpose", "vision"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: true,
      supportsTranscription: false,
      supportsSearch: true
    },
    aliases: ["gemini-3-pro-preview"]
  },
  "google-ai:gemini-2.5-flash-preview-tts": {
    id: "google-ai:gemini-2.5-flash-preview-tts",
    name: "Gemini 2.5 Flash TTS",
    description: "Native Gemini text-to-speech, fast tier",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "preview"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "google-ai:gemini-2.5-pro-preview-tts": {
    id: "google-ai:gemini-2.5-pro-preview-tts",
    name: "Gemini 2.5 Pro TTS",
    description: "Native Gemini text-to-speech, pro tier",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "preview"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "google-ai:imagen-4.0-ultra-generate-001": {
    id: "google-ai:imagen-4.0-ultra-generate-001",
    name: "Imagen 4 Ultra",
    description: "Google's highest-fidelity Imagen 4 variant.",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "google-ai:imagen-4.0-generate-001": {
    id: "google-ai:imagen-4.0-generate-001",
    name: "Imagen 4",
    description: "Google's standard Imagen 4 image generation model.",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "google-ai:imagen-4.0-fast-generate-001": {
    id: "google-ai:imagen-4.0-fast-generate-001",
    name: "Imagen 4 Fast",
    description: "Speed-optimized Imagen 4 variant.",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "google-ai:gemini-2.5-flash-image": {
    id: "google-ai:gemini-2.5-flash-image",
    name: "Gemini 2.5 Flash Image",
    description: 'Gemini-native image generation (formerly "Nano Banana"). Token-billed; ~$0.039 per 1024\xD71024 image. Supports image editing.',
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["image-generation"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "cerebras:gpt-oss-120b": {
    id: "cerebras:gpt-oss-120b",
    name: "GPT-OSS 120B (Preview)",
    description: "gpt-oss-120b is a high-performance, open-weight language model designed for production-grade, general-purpose use cases. It excels at complex reasoning and supports configurable reasoning effort, full chain-of-thought transparency for easier debugging and trust, and native agentic capabilities for function calling, tool use, and structured outputs.",
    input: {
      maxTokens: 131000,
      costPer1MTokens: 0.35
    },
    output: {
      maxTokens: 16000,
      costPer1MTokens: 0.75
    },
    tags: ["preview", "general-purpose", "reasoning"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "cerebras:qwen-3-32b": {
    id: "cerebras:qwen-3-32b",
    name: "Qwen3 32B",
    description: "Qwen3-32B is a world-class reasoning model with comparable quality to DeepSeek R1 while outperforming GPT-4.1 and Claude Sonnet 3.7. It excels in code-gen, tool-calling, and advanced reasoning, making it an exceptional model for a wide range of production use cases.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.4
    },
    output: {
      maxTokens: 16000,
      costPer1MTokens: 0.8
    },
    tags: ["general-purpose", "reasoning"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "cerebras:llama-4-scout-17b-16e-instruct": {
    id: "cerebras:llama-4-scout-17b-16e-instruct",
    name: "Llama 4 Scout 17B",
    description: "Llama 4 Scout 17B Instruct (16E) is a mixture-of-experts (MoE) language model developed by Meta, uses 16 experts per forward pass, activating 17 billion parameters out of a total of 109B. It supports native multimodal input (text and image) and multilingual output (text and code) across 12 supported languages.",
    input: {
      maxTokens: 32000,
      costPer1MTokens: 0.65
    },
    output: {
      maxTokens: 16000,
      costPer1MTokens: 0.85
    },
    tags: ["general-purpose", "vision"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "cerebras:llama3.1-8b": {
    id: "cerebras:llama3.1-8b",
    name: "Llama 3.1 8B",
    description: "Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8B and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks.",
    input: {
      maxTokens: 32000,
      costPer1MTokens: 0.1
    },
    output: {
      maxTokens: 16000,
      costPer1MTokens: 0.1
    },
    tags: ["deprecated", "low-cost", "general-purpose"],
    lifecycle: "deprecated",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "cerebras:llama3.3-70b": {
    id: "cerebras:llama3.3-70b",
    name: "Llama 3.3 70B",
    description: "Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8B and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.85
    },
    output: {
      maxTokens: 16000,
      costPer1MTokens: 1.2
    },
    tags: ["general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:qwen3-32b": {
    id: "groq:qwen3-32b",
    name: "Qwen3 32B (Preview)",
    description: "Qwen3-32B is a reasoning model from Alibaba. It excels in code-gen, tool-calling, and advanced reasoning. Served as a preview model on Groq with fast inference speeds.",
    input: {
      maxTokens: 131000,
      costPer1MTokens: 0.29
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.59
    },
    tags: ["preview", "reasoning", "general-purpose"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["qwen/qwen3-32b"]
  },
  "groq:llama-4-scout-17b-16e-instruct": {
    id: "groq:llama-4-scout-17b-16e-instruct",
    name: "Llama 4 Scout 17B (Preview)",
    description: "Llama 4 Scout 17B Instruct (16E) is a mixture-of-experts (MoE) language model developed by Meta, using 16 experts per forward pass and activating 17 billion parameters out of a total of 109B. Supports multimodal input (text and image) with multilingual output. Served as a preview model on Groq.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.11
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.34
    },
    tags: ["preview", "vision", "general-purpose", "low-cost"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["meta-llama/llama-4-scout-17b-16e-instruct"]
  },
  "groq:gpt-oss-20b": {
    id: "groq:gpt-oss-20b",
    name: "GPT-OSS 20B (Preview)",
    description: "gpt-oss-20b is a compact, open-weight language model optimized for low-latency. It shares the same training foundation and capabilities as the GPT-OSS 120B model, with faster responses and lower cost.",
    input: {
      maxTokens: 131000,
      costPer1MTokens: 0.075
    },
    output: {
      maxTokens: 32000,
      costPer1MTokens: 0.3
    },
    tags: ["preview", "general-purpose", "reasoning", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["openai/gpt-oss-20b"]
  },
  "groq:gpt-oss-120b": {
    id: "groq:gpt-oss-120b",
    name: "GPT-OSS 120B (Preview)",
    description: "gpt-oss-120b is a high-performance, open-weight language model designed for production-grade, general-purpose use cases. It excels at complex reasoning and supports configurable reasoning effort, full chain-of-thought transparency for easier debugging and trust, and native agentic capabilities for function calling, tool use, and structured outputs.",
    input: {
      maxTokens: 131000,
      costPer1MTokens: 0.15
    },
    output: {
      maxTokens: 32000,
      costPer1MTokens: 0.75
    },
    tags: ["preview", "general-purpose", "reasoning"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["openai/gpt-oss-120b"]
  },
  "groq:deepseek-r1-distill-llama-70b": {
    id: "groq:deepseek-r1-distill-llama-70b",
    name: "DeepSeek R1-Distill Llama 3.3 70B (Preview)",
    description: "A fine-tuned version of Llama 3.3 70B using samples generated by DeepSeek-R1, making it smarter than the original Llama 70B, particularly for tasks requiring mathematical and factual precision.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.75
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 0.99
    },
    tags: ["general-purpose", "reasoning", "preview"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama-3.3-70b-versatile": {
    id: "groq:llama-3.3-70b-versatile",
    name: "LLaMA 3.3 70B",
    description: "The Meta Llama 3.3 multilingual large language model (LLM) is a pretrained and instruction tuned generative model in 70B (text in/text out). The Llama 3.3 instruction tuned text only model is optimized for multilingual dialogue use cases and outperforms many of the available open source and closed chat models on common industry benchmarks.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.59
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 0.79
    },
    tags: ["recommended", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama-3.2-1b-preview": {
    id: "groq:llama-3.2-1b-preview",
    name: "LLaMA 3.2 1B (Preview)",
    description: "The Llama 3.2 instruction-tuned, text-only models are optimized for multilingual dialogue use cases, including agentic retrieval and summarization tasks.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.04
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.04
    },
    tags: ["low-cost", "deprecated"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama-3.2-3b-preview": {
    id: "groq:llama-3.2-3b-preview",
    name: "LLaMA 3.2 3B (Preview)",
    description: "The Llama 3.2 instruction-tuned, text-only models are optimized for multilingual dialogue use cases, including agentic retrieval and summarization tasks.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.06
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.06
    },
    tags: ["low-cost", "general-purpose", "deprecated"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama-3.2-11b-vision-preview": {
    id: "groq:llama-3.2-11b-vision-preview",
    name: "LLaMA 3.2 11B Vision (Preview)",
    description: "The Llama 3.2-Vision instruction-tuned models are optimized for visual recognition, image reasoning, captioning, and answering general questions about an image.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.18
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.18
    },
    tags: ["low-cost", "vision", "general-purpose", "deprecated"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama-3.2-90b-vision-preview": {
    id: "groq:llama-3.2-90b-vision-preview",
    name: "LLaMA 3.2 90B Vision (Preview)",
    description: "The Llama 3.2-Vision instruction-tuned models are optimized for visual recognition, image reasoning, captioning, and answering general questions about an image.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.9
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.9
    },
    tags: ["vision", "general-purpose", "deprecated"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama-3.1-8b-instant": {
    id: "groq:llama-3.1-8b-instant",
    name: "LLaMA 3.1 8B",
    description: "The Llama 3.1 instruction-tuned, text-only models are optimized for multilingual dialogue use cases.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.05
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.08
    },
    tags: ["low-cost", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama3-8b-8192": {
    id: "groq:llama3-8b-8192",
    name: "LLaMA 3 8B",
    description: "Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks.",
    input: {
      maxTokens: 8192,
      costPer1MTokens: 0.05
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.08
    },
    tags: ["low-cost", "general-purpose", "deprecated"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:llama3-70b-8192": {
    id: "groq:llama3-70b-8192",
    name: "LLaMA 3 70B",
    description: "Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks.",
    input: {
      maxTokens: 8192,
      costPer1MTokens: 0.59
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.79
    },
    tags: ["general-purpose", "deprecated"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:gemma2-9b-it": {
    id: "groq:gemma2-9b-it",
    name: "Gemma2 9B",
    description: "Redesigned for outsized performance and unmatched efficiency, Gemma 2 optimizes for blazing-fast inference on diverse hardware. Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights, pre-trained variants, and instruction-tuned variants. Gemma models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning.",
    input: {
      maxTokens: 8192,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.2
    },
    tags: ["low-cost", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "groq:whisper-large-v3": {
    id: "groq:whisper-large-v3",
    name: "Whisper V3",
    description: "Whisper Large V3 on Groq \u2014 fast, accurate multilingual speech recognition.",
    input: {
      maxTokens: 0,
      costPer1MTokens: 0,
      costPerMinute: 0.00185
    },
    output: {
      maxTokens: 0,
      costPer1MTokens: 0
    },
    tags: ["general-purpose", "speech-to-text"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: true,
      supportsSearch: false
    }
  },
  "groq:whisper-large-v3-turbo": {
    id: "groq:whisper-large-v3-turbo",
    name: "Whisper V3 Turbo",
    description: "Whisper Large V3 Turbo on Groq \u2014 optimized for speed with near-identical accuracy to V3.",
    input: {
      maxTokens: 0,
      costPer1MTokens: 0,
      costPerMinute: 0.000667
    },
    output: {
      maxTokens: 0,
      costPer1MTokens: 0
    },
    tags: ["low-cost", "general-purpose", "speech-to-text"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: true,
      supportsSearch: false
    }
  },
  "groq:distil-whisper-large-v3-en": {
    id: "groq:distil-whisper-large-v3-en",
    name: "Distil Whisper V3 (English)",
    description: "Distilled Whisper Large V3 on Groq \u2014 decommissioned, replaced by whisper-large-v3-turbo.",
    input: {
      maxTokens: 0,
      costPer1MTokens: 0,
      costPerMinute: 0.000333
    },
    output: {
      maxTokens: 0,
      costPer1MTokens: 0
    },
    tags: ["low-cost", "speech-to-text"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: true,
      supportsSearch: false
    }
  },
  "xai:grok-4-1-fast-reasoning": {
    id: "xai:grok-4-1-fast-reasoning",
    name: "Grok 4.1 Fast (Reasoning)",
    description: "Latest fast Grok model with reasoning capabilities and a massive 2M context window. Extremely cost-effective for a frontier-class model.",
    input: {
      maxTokens: 2000000,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 0.5
    },
    tags: ["recommended", "reasoning", "general-purpose", "vision", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-4-1-fast-non-reasoning": {
    id: "xai:grok-4-1-fast-non-reasoning",
    name: "Grok 4.1 Fast (Non-Reasoning)",
    description: "Latest fast Grok model for non-reasoning tasks with a massive 2M context window. Extremely cost-effective for a frontier-class model.",
    input: {
      maxTokens: 2000000,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 0.5
    },
    tags: ["recommended", "general-purpose", "vision", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-4.20-0309-reasoning": {
    id: "xai:grok-4.20-0309-reasoning",
    name: "Grok 4.20 (Reasoning)",
    description: "xAI flagship model with deep reasoning capabilities and 2M context window.",
    input: {
      maxTokens: 2000000,
      costPer1MTokens: 2
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 6
    },
    tags: ["reasoning", "general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-4.20-0309-non-reasoning": {
    id: "xai:grok-4.20-0309-non-reasoning",
    name: "Grok 4.20 (Non-Reasoning)",
    description: "xAI flagship model for non-reasoning tasks with 2M context window.",
    input: {
      maxTokens: 2000000,
      costPer1MTokens: 2
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 6
    },
    tags: ["general-purpose", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-code-fast-1": {
    id: "xai:grok-code-fast-1",
    name: "Grok Code Fast 1",
    description: "Fast coding-optimized Grok model with large context window.",
    input: {
      maxTokens: 256000,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 1.5
    },
    tags: ["coding", "general-purpose", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-4-fast-reasoning": {
    id: "xai:grok-4-fast-reasoning",
    name: "Grok 4 Fast (Reasoning)",
    description: "Advanced fast Grok model with reasoning and very large context.",
    input: {
      maxTokens: 2000000,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 0.5
    },
    tags: ["reasoning", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-4-fast-non-reasoning": {
    id: "xai:grok-4-fast-non-reasoning",
    name: "Grok 4 Fast (Non-Reasoning)",
    description: "Fast, cost-effective Grok model for non-reasoning tasks.",
    input: {
      maxTokens: 2000000,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 128000,
      costPer1MTokens: 0.5
    },
    tags: ["low-cost", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-4-0709": {
    id: "xai:grok-4-0709",
    name: "Grok 4 (0709)",
    description: "Comprehensive Grok 4 model for general-purpose tasks.",
    input: {
      maxTokens: 256000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 15
    },
    tags: ["reasoning", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-3-mini": {
    id: "xai:grok-3-mini",
    name: "Grok 3 Mini",
    description: "Lightweight Grok model for cost-sensitive workloads.",
    input: {
      maxTokens: 131072,
      costPer1MTokens: 0.3
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.5
    },
    tags: ["low-cost", "general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "xai:grok-3": {
    id: "xai:grok-3",
    name: "Grok 3",
    description: "Enterprise-grade Grok model for general-purpose tasks.",
    input: {
      maxTokens: 131072,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 15
    },
    tags: ["general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "openrouter:gpt-oss-120b": {
    id: "openrouter:gpt-oss-120b",
    name: "GPT-OSS 120B (Preview)",
    description: "gpt-oss-120b is a high-performance, open-weight language model designed for production-grade, general-purpose use cases. It excels at complex reasoning and supports configurable reasoning effort, full chain-of-thought transparency for easier debugging and trust, and native agentic capabilities for function calling, tool use, and structured outputs.",
    input: {
      maxTokens: 131000,
      costPer1MTokens: 0.15
    },
    output: {
      maxTokens: 32000,
      costPer1MTokens: 0.75
    },
    tags: ["preview", "general-purpose", "reasoning"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "fireworks-ai:kimi-k2p6": {
    id: "fireworks-ai:kimi-k2p6",
    name: "Kimi K2.6",
    description: "Kimi K2.6 is an open-source, native multimodal agentic model with a 1 trillion parameter mixture-of-experts architecture. It delivers strong performance on agentic and reasoning tasks with a 262K context window.",
    input: {
      maxTokens: 262144,
      costPer1MTokens: 0.95
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 4
    },
    tags: ["recommended", "reasoning", "general-purpose", "agents", "vision"],
    lifecycle: "production",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/kimi-k2p6"]
  },
  "fireworks-ai:kimi-k2p5": {
    id: "fireworks-ai:kimi-k2p5",
    name: "Kimi K2.5",
    description: "Kimi K2.5 is an open-source mixture-of-experts agentic model with strong reasoning and tool-use capabilities. Features a 262K context window at a cost-effective price point.",
    input: {
      maxTokens: 262144,
      costPer1MTokens: 0.6
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 3
    },
    tags: ["reasoning", "general-purpose", "agents"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/kimi-k2p5"]
  },
  "fireworks-ai:qwen3-8b": {
    id: "fireworks-ai:qwen3-8b",
    name: "Qwen3 8B",
    description: "Qwen3 8B is a newer-generation small model with better architecture than Llama 3.1 8B. Same price tier with improved quality across reasoning and coding tasks.",
    input: {
      maxTokens: 40960,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.2
    },
    tags: ["low-cost", "general-purpose", "reasoning"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/qwen3-8b"]
  },
  "fireworks-ai:gpt-oss-20b": {
    id: "fireworks-ai:gpt-oss-20b",
    name: "GPT-OSS 20B",
    description: "gpt-oss-20b is a compact, open-weight language model optimized for low-latency. It shares the same training foundation and capabilities as the GPT-OSS 120B model, with faster responses and lower cost.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.07
    },
    output: {
      maxTokens: 16000,
      costPer1MTokens: 0.3
    },
    tags: ["general-purpose", "reasoning", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/gpt-oss-20b"]
  },
  "fireworks-ai:gpt-oss-120b": {
    id: "fireworks-ai:gpt-oss-120b",
    name: "GPT-OSS 120B",
    description: "gpt-oss-120b is a high-performance, open-weight language model designed for production-grade, general-purpose use cases. It excels at complex reasoning and supports configurable reasoning effort, full chain-of-thought transparency for easier debugging and trust, and native agentic capabilities for function calling, tool use, and structured outputs.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.15
    },
    output: {
      maxTokens: 16000,
      costPer1MTokens: 0.6
    },
    tags: ["general-purpose", "reasoning"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/gpt-oss-120b"]
  },
  "fireworks-ai:deepseek-v3p2": {
    id: "fireworks-ai:deepseek-v3p2",
    name: "DeepSeek V3.2",
    description: "DeepSeek V3.2 is a 675B-parameter mixture-of-experts model with superior reasoning and agent performance. It delivers high computational efficiency with strong results across coding, math, and general-purpose tasks.",
    input: {
      maxTokens: 163840,
      costPer1MTokens: 0.56
    },
    output: {
      maxTokens: 160000,
      costPer1MTokens: 1.68
    },
    tags: ["recommended", "reasoning", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/deepseek-v3p2"]
  },
  "fireworks-ai:deepseek-v3p1": {
    id: "fireworks-ai:deepseek-v3p1",
    name: "DeepSeek V3.1",
    description: "DeepSeek V3.1 is a 685B-parameter hybrid LLM with mixture-of-experts architecture (37B activated per token). Features thinking and non-thinking chat modes for complex agentic behaviors and reasoning tasks.",
    input: {
      maxTokens: 163840,
      costPer1MTokens: 0.56
    },
    output: {
      maxTokens: 163840,
      costPer1MTokens: 1.68
    },
    tags: ["reasoning", "general-purpose", "coding"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/deepseek-v3p1"]
  },
  "fireworks-ai:deepseek-r1-0528": {
    id: "fireworks-ai:deepseek-r1-0528",
    name: "DeepSeek R1 0528",
    description: "The updated DeepSeek R1 0528 model delivers major improvements in reasoning, inference, and accuracy through enhanced post-training optimization and greater computational resources. It now performs at a level approaching top-tier models like OpenAI o3 and Gemini 2.5 Pro, with notable gains in complex tasks such as math and programming. The update also reduces hallucinations, improves function calling, and enhances the coding experience.",
    input: {
      maxTokens: 160000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 8
    },
    tags: ["recommended", "reasoning", "general-purpose", "coding"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/deepseek-r1-0528"]
  },
  "fireworks-ai:deepseek-v3-0324": {
    id: "fireworks-ai:deepseek-v3-0324",
    name: "DeepSeek V3 0324",
    description: "DeepSeek V3, a 685B-parameter, mixture-of-experts model, is the latest iteration of the flagship chat model family from the DeepSeek team. It succeeds the DeepSeek V3 model and performs really well on a variety of tasks.",
    input: {
      maxTokens: 160000,
      costPer1MTokens: 0.9
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.9
    },
    tags: ["recommended", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/deepseek-v3-0324"]
  },
  "fireworks-ai:llama4-maverick-instruct-basic": {
    id: "fireworks-ai:llama4-maverick-instruct-basic",
    name: "Llama 4 Maverick Instruct (Basic)",
    description: "Llama 4 Maverick 17B Instruct (128E) is a high-capacity multimodal language model from Meta, built on a mixture-of-experts (MoE) architecture with 128 experts and 17 billion active parameters per forward pass (400B total). It supports multilingual text and image input, and produces multilingual text and code output across 12 supported languages. Optimized for vision-language tasks, Maverick is instruction-tuned for assistant-like behavior, image reasoning, and general-purpose multimodal interaction, and suited for research and commercial applications requiring advanced multimodal understanding and high model throughput.",
    input: {
      maxTokens: 1e6,
      costPer1MTokens: 0.22
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.88
    },
    tags: ["general-purpose", "vision"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/llama4-maverick-instruct-basic"]
  },
  "fireworks-ai:llama4-scout-instruct-basic": {
    id: "fireworks-ai:llama4-scout-instruct-basic",
    name: "Llama 4 Scout Instruct (Basic)",
    description: "Llama 4 Scout 17B Instruct (16E) is a mixture-of-experts (MoE) language model developed by Meta, uses 16 experts per forward pass, activating 17 billion parameters out of a total of 109B. It supports native multimodal input (text and image) and multilingual output (text and code) across 12 supported languages. Designed for assistant-style interaction and visual reasoning, it is instruction-tuned for use in multilingual chat, captioning, and image understanding tasks.",
    input: {
      maxTokens: 1048576,
      costPer1MTokens: 0.15
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.6
    },
    tags: ["general-purpose", "vision"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: true,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/llama4-scout-instruct-basic"]
  },
  "fireworks-ai:llama-v3p3-70b-instruct": {
    id: "fireworks-ai:llama-v3p3-70b-instruct",
    name: "Llama 3.3 70B Instruct",
    description: "Llama 3.3 70B Instruct is the December update of Llama 3.1 70B. The model improves upon Llama 3.1 70B (released July 2024) with advances in tool calling, multilingual text support, math and coding. The model achieves industry leading results in reasoning, math and instruction following and provides similar performance as 3.1 405B but with significant speed and cost improvements.",
    input: {
      maxTokens: 131072,
      costPer1MTokens: 0.9
    },
    output: {
      maxTokens: 16384,
      costPer1MTokens: 0.9
    },
    tags: ["general-purpose"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/llama-v3p3-70b-instruct"]
  },
  "fireworks-ai:deepseek-r1": {
    id: "fireworks-ai:deepseek-r1",
    name: "DeepSeek R1 (Fast)",
    description: `This version of the R1 model has a perfect balance between speed and cost-efficiency for real-time interactive experiences, with speeds up to 90 tokens per second.

DeepSeek-R1 is a state-of-the-art large language model optimized with reinforcement learning and cold-start data for exceptional reasoning, math, and code performance. **Note**: This model will always use a temperature of 0.6 as recommended by DeepSeek.`,
    input: {
      maxTokens: 128000,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 8
    },
    tags: ["reasoning", "general-purpose", "coding"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/deepseek-r1"]
  },
  "fireworks-ai:deepseek-r1-basic": {
    id: "fireworks-ai:deepseek-r1-basic",
    name: "DeepSeek R1 (Basic)",
    description: `This version of the R1 model is optimized for throughput and cost-effectiveness and has a lower cost but slightly higher latency than the "Fast" version of the model.

DeepSeek-R1 is a state-of-the-art large language model optimized with reinforcement learning and cold-start data for exceptional reasoning, math, and code performance. **Note**: This model will always use a temperature of 0.6 as recommended by DeepSeek.`,
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.55
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 2.19
    },
    tags: ["reasoning", "general-purpose", "coding"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/deepseek-r1-basic"]
  },
  "fireworks-ai:deepseek-v3": {
    id: "fireworks-ai:deepseek-v3",
    name: "DeepSeek V3",
    description: "A a strong Mixture-of-Experts (MoE) language model with 671B total parameters with 37B activated for each token from Deepseek.",
    input: {
      maxTokens: 128000,
      costPer1MTokens: 0.9
    },
    output: {
      maxTokens: 8000,
      costPer1MTokens: 0.9
    },
    tags: ["deprecated", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/deepseek-v3"]
  },
  "fireworks-ai:llama-v3p1-405b-instruct": {
    id: "fireworks-ai:llama-v3p1-405b-instruct",
    name: "Llama 3.1 405B Instruct",
    description: "The Meta Llama 3.1 collection of multilingual large language models (LLMs) is a collection of pretrained and instruction tuned generative models in 8B, 70B and 405B sizes. The Llama 3.1 instruction tuned text only models (8B, 70B, 405B) are optimized for multilingual dialogue use cases and outperform many of the available open source and closed chat models on common industry benchmarks.",
    input: {
      maxTokens: 131072,
      costPer1MTokens: 3
    },
    output: {
      maxTokens: 131072,
      costPer1MTokens: 3
    },
    tags: ["deprecated", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/llama-v3p1-405b-instruct"]
  },
  "fireworks-ai:llama-v3p1-70b-instruct": {
    id: "fireworks-ai:llama-v3p1-70b-instruct",
    name: "Llama 3.1 70B Instruct",
    description: "The Meta Llama 3.1 collection of multilingual large language models (LLMs) is a collection of pretrained and instruction tuned generative models in 8B, 70B and 405B sizes. The Llama 3.1 instruction tuned text only models (8B, 70B, 405B) are optimized for multilingual dialogue use cases and outperform many of the available open source and closed chat models on common industry benchmarks.",
    input: {
      maxTokens: 131072,
      costPer1MTokens: 0.9
    },
    output: {
      maxTokens: 131072,
      costPer1MTokens: 0.9
    },
    tags: ["deprecated", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/llama-v3p1-70b-instruct"]
  },
  "fireworks-ai:llama-v3p1-8b-instruct": {
    id: "fireworks-ai:llama-v3p1-8b-instruct",
    name: "Llama 3.1 8B Instruct",
    description: "The Meta Llama 3.1 collection of multilingual large language models (LLMs) is a collection of pretrained and instruction tuned generative models in 8B, 70B and 405B sizes. The Llama 3.1 instruction tuned text only models (8B, 70B, 405B) are optimized for multilingual dialogue use cases and outperform many of the available open source and closed chat models on common industry benchmarks.",
    input: {
      maxTokens: 131072,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 131072,
      costPer1MTokens: 0.2
    },
    tags: ["low-cost", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/llama-v3p1-8b-instruct"]
  },
  "fireworks-ai:mixtral-8x22b-instruct": {
    id: "fireworks-ai:mixtral-8x22b-instruct",
    name: "Mixtral MoE 8x22B Instruct",
    description: "Mistral MoE 8x22B Instruct v0.1 model with Sparse Mixture of Experts. Fine tuned for instruction following.",
    input: {
      maxTokens: 65536,
      costPer1MTokens: 1.2
    },
    output: {
      maxTokens: 65536,
      costPer1MTokens: 1.2
    },
    tags: ["deprecated", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/mixtral-8x22b-instruct"]
  },
  "fireworks-ai:mixtral-8x7b-instruct": {
    id: "fireworks-ai:mixtral-8x7b-instruct",
    name: "Mixtral MoE 8x7B Instruct",
    description: "Mistral MoE 8x7B Instruct v0.1 model with Sparse Mixture of Experts. Fine tuned for instruction following",
    input: {
      maxTokens: 32768,
      costPer1MTokens: 0.5
    },
    output: {
      maxTokens: 32768,
      costPer1MTokens: 0.5
    },
    tags: ["low-cost", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/mixtral-8x7b-instruct"]
  },
  "fireworks-ai:mythomax-l2-13b": {
    id: "fireworks-ai:mythomax-l2-13b",
    name: "MythoMax L2 13b",
    description: "MythoMax L2 is designed to excel at both roleplaying and storytelling, and is an improved variant of the previous MythoMix model, combining the MythoLogic-L2 and Huginn models.",
    input: {
      maxTokens: 4096,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 4096,
      costPer1MTokens: 0.2
    },
    tags: ["roleplay", "storytelling", "low-cost"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/mythomax-l2-13b"]
  },
  "fireworks-ai:gemma2-9b-it": {
    id: "fireworks-ai:gemma2-9b-it",
    name: "Gemma 2 9B Instruct",
    description: "Redesigned for outsized performance and unmatched efficiency, Gemma 2 optimizes for blazing-fast inference on diverse hardware. Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights, pre-trained variants, and instruction-tuned variants. Gemma models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning.",
    input: {
      maxTokens: 8192,
      costPer1MTokens: 0.2
    },
    output: {
      maxTokens: 8192,
      costPer1MTokens: 0.2
    },
    tags: ["deprecated", "low-cost", "general-purpose"],
    lifecycle: "discontinued",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    },
    aliases: ["accounts/fireworks/models/gemma2-9b-it"]
  },
  "fireworks-ai:whisper-v3": {
    id: "fireworks-ai:whisper-v3",
    name: "Whisper V3",
    description: "Whisper V3 on Fireworks AI \u2014 multilingual speech recognition with high accuracy.",
    input: {
      maxTokens: 0,
      costPer1MTokens: 0,
      costPerMinute: 0.0015
    },
    output: {
      maxTokens: 0,
      costPer1MTokens: 0
    },
    tags: ["general-purpose", "speech-to-text"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: true,
      supportsSearch: false
    }
  },
  "elevenlabs:eleven_v3": {
    id: "elevenlabs:eleven_v3",
    name: "ElevenLabs v3 (Alpha)",
    description: "Most expressive ElevenLabs model, alpha quality",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "preview"],
    lifecycle: "preview",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "elevenlabs:eleven_multilingual_v2": {
    id: "elevenlabs:eleven_multilingual_v2",
    name: "ElevenLabs Multilingual v2",
    description: "Production multilingual voice synthesis (29 languages)",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "elevenlabs:eleven_turbo_v2_5": {
    id: "elevenlabs:eleven_turbo_v2_5",
    name: "ElevenLabs Turbo v2.5",
    description: "Fast multilingual TTS",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "low-cost"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  },
  "elevenlabs:eleven_flash_v2_5": {
    id: "elevenlabs:eleven_flash_v2_5",
    name: "ElevenLabs Flash v2.5",
    description: "Lowest latency TTS, ~75ms TTFB",
    input: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    output: {
      maxTokens: 1,
      costPer1MTokens: 0
    },
    tags: ["text-to-speech", "low-cost", "recommended"],
    lifecycle: "production",
    capabilities: {
      supportsImages: false,
      supportsAudio: false,
      supportsTranscription: false,
      supportsSearch: false
    }
  }
};
var defaultModel = {
  id: "",
  name: "",
  description: "",
  input: {
    costPer1MTokens: 0,
    maxTokens: 1e6
  },
  output: {
    costPer1MTokens: 0,
    maxTokens: 1e6
  },
  tags: [],
  lifecycle: "production"
};
function buildResponseFromBetaMetadata(output, metadata) {
  return {
    output: {
      id: "beta-output",
      provider: metadata.provider,
      model: metadata.model,
      choices: [
        {
          type: "text",
          content: output,
          role: "assistant",
          index: 0,
          stopReason: metadata.stopReason ?? "stop"
        }
      ],
      usage: {
        inputTokens: metadata.usage.inputTokens,
        inputCost: 0,
        outputTokens: metadata.usage.outputTokens,
        outputCost: metadata.cost ?? 0
      },
      botpress: {
        cost: metadata.cost ?? 0
      }
    },
    meta: {
      cached: metadata.cached,
      model: { integration: metadata.provider, model: metadata.model },
      latency: metadata.latency,
      cost: {
        input: 0,
        output: metadata.cost || 0
      },
      tokens: {
        input: metadata.usage.inputTokens,
        output: metadata.usage.outputTokens
      }
    }
  };
}
function toBetaInput(input) {
  const v2Input = { ...input, messages: [...input.messages] };
  if (v2Input.systemPrompt) {
    v2Input.messages.unshift({ role: "system", content: v2Input.systemPrompt });
    delete v2Input.systemPrompt;
  }
  return v2Input;
}
function cognitiveFromBeta(beta) {
  let remoteModels = null;
  const fetchRemote = async () => {
    if (remoteModels)
      return remoteModels;
    const list = await beta.listModels();
    const map = /* @__PURE__ */ new Map;
    for (const m of list) {
      const converted = { ...m, ref: m.id, integration: "cognitive-v2" };
      map.set(m.id, converted);
      for (const alias of m.aliases ?? []) {
        map.set(alias, converted);
      }
    }
    remoteModels = map;
    return map;
  };
  return {
    async getModelDetails(model) {
      const resolved = getCognitiveV2Model(model);
      if (resolved) {
        return { ...resolved, ref: resolved.id, integration: "cognitive-v2" };
      }
      try {
        const found = (await fetchRemote()).get(model);
        if (found)
          return found;
      } catch {}
      return {
        id: model,
        ref: model,
        integration: "cognitive-v2",
        name: model,
        description: "",
        tags: [],
        input: { maxTokens: 128000, costPer1MTokens: 0 },
        output: { maxTokens: 8192, costPer1MTokens: 0 }
      };
    },
    async generateContent(input) {
      const response = await beta.generateText(toBetaInput(input), {
        signal: input.signal
      });
      return buildResponseFromBetaMetadata(response.output, response.metadata);
    },
    async* generateContentStream(input) {
      const v2Input = toBetaInput(input);
      let lastMetadata;
      const parts = [];
      for await (const chunk of beta.generateTextStream(v2Input, { signal: input.signal })) {
        if (chunk.output)
          parts.push(chunk.output);
        if (chunk.metadata)
          lastMetadata = chunk.metadata;
        yield chunk;
      }
      if (!lastMetadata) {
        throw new Error("Streaming completed without metadata");
      }
      return buildResponseFromBetaMetadata(parts.join(""), lastMetadata);
    }
  };
}
var isBrowser = () => typeof window !== "undefined" && typeof window.fetch === "function";
var CognitiveBeta2 = class _CognitiveBeta {
  ["$$IS_COGNITIVE_BETA"] = "v2";
  static isBetaClient(obj) {
    return obj?.["$$IS_COGNITIVE_BETA"] === "v2";
  }
  _axiosClient;
  _apiUrl;
  _timeout;
  _withCredentials;
  _headers;
  _debug = false;
  _events = createNanoEvents();
  constructor(props) {
    this._apiUrl = props.apiUrl || "https://api.botpress.cloud";
    this._timeout = props.timeout || 60001;
    this._withCredentials = props.withCredentials || false;
    this._headers = { ...props.headers };
    if (props.botId) {
      this._headers["X-Bot-Id"] = props.botId;
    }
    if (props.token) {
      this._headers["Authorization"] = `Bearer ${props.token}`;
    }
    if (props.debug) {
      this._debug = true;
      this._headers["X-Debug"] = "1";
    }
    this._axiosClient = axios_default.create({
      headers: this._headers,
      withCredentials: this._withCredentials,
      baseURL: this._apiUrl
    });
  }
  clone() {
    return new _CognitiveBeta({
      apiUrl: this._apiUrl,
      timeout: this._timeout,
      withCredentials: this._withCredentials,
      headers: this._headers,
      debug: this._debug
    });
  }
  on(event, cb) {
    return this._events.on(event, cb);
  }
  async generateText(input, options = {}) {
    const signal = options.signal ?? AbortSignal.timeout(this._timeout);
    const req = { type: "generateText", input };
    this._events.emit("request", req);
    try {
      const { data } = await this._withServerRetry(() => this._axiosClient.post("/v2/cognitive/generate-text", input, {
        signal,
        timeout: options.timeout ?? this._timeout
      }), options, req);
      this._events.emit("response", req, data);
      return data;
    } catch (error) {
      this._events.emit("error", req, error);
      throw error;
    }
  }
  async listModels() {
    const { data } = await this._withServerRetry(() => this._axiosClient.get("/v2/cognitive/models"));
    return data.models;
  }
  async listVoices(filter = {}) {
    const { data } = await this._withServerRetry(() => this._axiosClient.get("/v2/cognitive/voices", {
      params: filter,
      paramsSerializer: { encode: encodeURIComponent }
    }));
    return data.voices;
  }
  async generateAudio(input, options = {}) {
    const signal = options.signal ?? AbortSignal.timeout(this._timeout);
    const req = { type: "generateAudio", input };
    this._events.emit("request", req);
    try {
      const { data } = await this._withServerRetry(() => this._axiosClient.post("/v2/cognitive/generate-audio", input, {
        signal,
        timeout: options.timeout ?? this._timeout
      }), options, req);
      this._events.emit("response", req, data);
      return data;
    } catch (error) {
      this._events.emit("error", req, error);
      throw error;
    }
  }
  async generateImage(input, options = {}) {
    const signal = options.signal ?? AbortSignal.timeout(this._timeout);
    const req = { type: "generateImage", input };
    this._events.emit("request", req);
    try {
      const { data } = await this._withServerRetry(() => this._axiosClient.post("/v2/cognitive/generate-image", input, {
        signal,
        timeout: options.timeout ?? this._timeout
      }), options, req);
      this._events.emit("response", req, data);
      return data;
    } catch (error) {
      this._events.emit("error", req, error);
      throw error;
    }
  }
  async transcribeAudio(input, options = {}) {
    const signal = options.signal ?? AbortSignal.timeout(this._timeout);
    const req = { type: "transcribeAudio", input };
    this._events.emit("request", req);
    try {
      const { data } = await this._withServerRetry(() => this._axiosClient.post("/v2/cognitive/transcribe-audio", input, {
        signal,
        timeout: options.timeout ?? this._timeout
      }), options, req);
      if (data.error) {
        throw new Error(`Transcription error: ${data.error}`);
      }
      this._events.emit("response", req, data);
      return data;
    } catch (error) {
      this._events.emit("error", req, error);
      throw error;
    }
  }
  async* generateTextStream(request, options = {}) {
    const signal = options.signal ?? AbortSignal.timeout(this._timeout);
    const req = { type: "generateText", input: request };
    const chunks = [];
    let lastChunk;
    this._events.emit("request", req);
    try {
      if (isBrowser()) {
        const res2 = await fetch(`${this._apiUrl}/v2/cognitive/generate-text-stream`, {
          method: "POST",
          headers: {
            ...this._headers,
            "Content-Type": "application/json"
          },
          credentials: this._withCredentials ? "include" : "omit",
          body: JSON.stringify({ ...request, stream: true }),
          signal
        });
        if (!res2.ok) {
          const text = await res2.text().catch(() => "");
          const err = new Error(`HTTP ${res2.status}: ${text || res2.statusText}`);
          err.response = { status: res2.status, data: text };
          throw err;
        }
        const body = res2.body;
        if (!body) {
          throw new Error("No response body received for streaming request");
        }
        const reader = body.getReader();
        const iterable = async function* () {
          for (;; ) {
            const { value, done } = await reader.read();
            if (done) {
              break;
            }
            if (value) {
              yield value;
            }
          }
        }();
        for await (const obj of this._ndjson(iterable)) {
          chunks.push(obj);
          lastChunk = obj;
          yield obj;
        }
        if (lastChunk?.metadata) {
          this._events.emit("response", req, {
            output: chunks.map((c) => c.output || "").join(""),
            metadata: lastChunk.metadata
          });
        }
        return;
      }
      const res = await this._withServerRetry(() => this._axiosClient.post("/v2/cognitive/generate-text-stream", { ...request, stream: true }, {
        responseType: "stream",
        signal,
        timeout: options.timeout ?? this._timeout
      }), options, req);
      const nodeStream = res.data;
      if (!nodeStream) {
        throw new Error("No response body received for streaming request");
      }
      for await (const obj of this._ndjson(nodeStream)) {
        chunks.push(obj);
        lastChunk = obj;
        yield obj;
      }
      if (lastChunk?.metadata) {
        this._events.emit("response", req, {
          output: chunks.map((c) => c.output || "").join(""),
          metadata: lastChunk.metadata
        });
      }
    } catch (error) {
      this._events.emit("error", req, error);
      throw error;
    }
  }
  async* generateAudioStream(input, options = {}) {
    const signal = options.signal ?? AbortSignal.timeout(this._timeout);
    const req = { type: "generateAudio", input };
    let finalChunk;
    this._events.emit("request", req);
    try {
      if (isBrowser()) {
        const res = await fetch(`${this._apiUrl}/v2/cognitive/generate-audio-stream`, {
          method: "POST",
          headers: {
            ...this._headers,
            "Content-Type": "application/json"
          },
          credentials: this._withCredentials ? "include" : "omit",
          body: JSON.stringify(input),
          signal
        });
        if (!res.ok) {
          const text = await res.text().catch(() => "");
          const err = new Error(`HTTP ${res.status}: ${text || res.statusText}`);
          err.response = { status: res.status, data: text };
          throw err;
        }
        const body = res.body;
        if (!body) {
          throw new Error("No response body received for streaming request");
        }
        const reader = body.getReader();
        const iterable = async function* () {
          for (;; ) {
            const { value, done } = await reader.read();
            if (done) {
              break;
            }
            if (value) {
              yield value;
            }
          }
        }();
        for await (const obj of this._ndjson(iterable)) {
          if (obj.finished) {
            finalChunk = obj;
          }
          yield obj;
        }
      } else {
        const res = await this._withServerRetry(() => this._axiosClient.post("/v2/cognitive/generate-audio-stream", input, {
          responseType: "stream",
          signal,
          timeout: options.timeout ?? this._timeout
        }), options, req);
        const nodeStream = res.data;
        if (!nodeStream) {
          throw new Error("No response body received for streaming request");
        }
        for await (const obj of this._ndjson(nodeStream)) {
          if (obj.finished) {
            finalChunk = obj;
          }
          yield obj;
        }
      }
      if (finalChunk) {
        this._events.emit("response", req, {
          output: { audioUrl: finalChunk.audioUrl },
          metadata: finalChunk.metadata
        });
      }
    } catch (error) {
      this._events.emit("error", req, error);
      throw error;
    }
  }
  async* _ndjson(stream) {
    const decoder = new TextDecoder("utf-8");
    let buffer = "";
    for await (const chunk of stream) {
      buffer += decoder.decode(chunk, { stream: true });
      for (;; ) {
        const i = buffer.indexOf(`
`);
        if (i < 0) {
          break;
        }
        const line = buffer.slice(0, i).replace(/\r$/, "");
        buffer = buffer.slice(i + 1);
        if (!line) {
          continue;
        }
        yield JSON.parse(line);
      }
    }
    buffer += decoder.decode();
    const tail = buffer.trim();
    if (tail) {
      yield JSON.parse(tail);
    }
  }
  _isRetryableServerError(error) {
    if (axios_default.isAxiosError(error)) {
      if (!error.response) {
        return true;
      }
      const status = error.response?.status;
      if (status && [502, 503, 504].includes(status)) {
        return true;
      }
      if (error.code && ["ECONNABORTED", "ECONNRESET", "ETIMEDOUT", "EAI_AGAIN", "ENOTFOUND", "EPIPE"].includes(error.code)) {
        return true;
      }
    }
    return false;
  }
  async _withServerRetry(fn, options = {}, req) {
    let attemptCount = 0;
    return (0, import_exponential_backoff.backOff)(async () => {
      try {
        const result = await fn();
        attemptCount = 0;
        return result;
      } catch (error) {
        if (attemptCount > 0 && req) {
          this._events.emit("retry", req, error);
        }
        attemptCount++;
        throw error;
      }
    }, {
      numOfAttempts: 3,
      startingDelay: 300,
      timeMultiple: 2,
      jitter: "full",
      retry: (e) => !options.signal?.aborted && this._isRetryableServerError(e)
    });
  }
};
var COGNITIVE_V2_PROVIDERS = /* @__PURE__ */ new Set([
  "openai",
  "anthropic",
  "google-ai",
  "groq",
  "cerebras",
  "fireworks-ai",
  "xai",
  "openrouter"
]);
var isKnownV2Model = (model) => {
  if (!model || ["auto", "best", "fast"].includes(model)) {
    return true;
  }
  const provider = model.split(":")[0];
  return !!provider && COGNITIVE_V2_PROVIDERS.has(provider);
};
var getCognitiveV2Model = (model) => {
  if (models[model]) {
    return models[model];
  }
  const [_provider, baseModel] = model.split(":");
  const alias = Object.values(models).find((x) => x.aliases ? x.aliases.includes(model) || baseModel && x.aliases.includes(baseModel) : false);
  if (alias) {
    return alias;
  }
  if (["auto", "fast", "best"].includes(model)) {
    return { ...defaultModel, id: model, name: model };
  }
  return;
};
var getActionFromError = (error) => {
  if (!isBotpressError(error)) {
    return "retry";
  }
  if (error.type === "InvalidDataFormat") {
    if (error.message?.includes("data/model/id")) {
      return "fallback";
    }
    return "abort";
  }
  if (error.type === "QuotaExceeded" || error.type === "RateLimited" || error.type === "Unknown" || error.type === "LimitExceeded") {
    return "retry";
  }
  const subtype = error.metadata?.subtype;
  if (subtype === "UPSTREAM_PROVIDER_FAILED") {
    return "fallback";
  }
  if (error.type === "Internal") {
    return "retry";
  }
  return "abort";
};
var isNotFoundError = (error) => isBotpressError(error) && error.type === "ResourceNotFound";
var isForbiddenOrUnauthorizedError = (error) => isBotpressError(error) && (error.type === "Forbidden" || error.type === "Unauthorized");
var isBotpressError = (error) => typeof error === "object" && error !== null && ("isApiError" in error) && ("code" in error) && ("type" in error) && ("id" in error);
var InterceptorManager = class {
  _interceptors = [];
  use(interceptor) {
    this._interceptors.push(interceptor);
    return () => this.remove(interceptor);
  }
  remove(interceptor) {
    this._interceptors = this._interceptors.filter((i) => i !== interceptor);
  }
  async run(value, signal) {
    let error = null;
    let result = value;
    let done = false;
    for (const interceptor of this._interceptors) {
      if (done) {
        break;
      }
      if (signal.aborted) {
        throw signal.reason;
      }
      await new Promise((resolve) => {
        interceptor(error, result, (err, val) => {
          error = err;
          result = val;
          resolve();
        }, (err, val) => {
          error = err;
          result = val;
          done = true;
          resolve();
        });
      });
    }
    if (error) {
      throw error;
    }
    return result;
  }
};
var DOWNTIME_THRESHOLD_MINUTES = 5;
var PREFERENCES_FILE_SUFFIX = "models.config.json";
var DEFAULT_INTEGRATIONS = ["google-ai", "anthropic", "openai", "cerebras", "fireworks-ai", "groq"];
var VendorPreferences = ["google-ai", "anthropic", "openai"];
var BestModelPreferences = ["4.1", "4o", "3-5-sonnet", "gemini-1.5-pro"];
var FastModelPreferences = ["gemini-1.5-flash", "4.1-mini", "4.1-nano", "4o-mini", "flash", "haiku"];
var InputPricePenalty = 3;
var OutputPricePenalty = 10;
var LowTokensPenalty = 128000;
var isRecommended = (model) => model.tags.includes("recommended");
var isDeprecated = (model) => model.tags.includes("deprecated");
var isLowCost = (model) => model.tags.includes("low-cost");
var hasVisionSupport = (model) => model.tags.includes("vision");
var isGeneralPurpose = (model) => model.tags.includes("general-purpose");
var scoreModel = (model, type, boosts = {}) => {
  let score = 0;
  const scores = [
    ["input price penalty", model.input.costPer1MTokens > InputPricePenalty, -1],
    ["output price penalty", model.output.costPer1MTokens > OutputPricePenalty, -1],
    ["low tokens penalty", (model.input.maxTokens ?? 0) + (model.output.maxTokens ?? 0) < LowTokensPenalty, -1],
    ["recommended", isRecommended(model), 2],
    ["deprecated", isDeprecated(model), -2],
    ["vision support", hasVisionSupport(model), 1],
    ["general purpose", isGeneralPurpose(model), 1],
    ["vendor preference", VendorPreferences.includes(model.integration), 1],
    ["best model preference", type === "best" && BestModelPreferences.some((x) => model.id.includes(x)), 1],
    ["fast model preference penalty", type === "best" && FastModelPreferences.some((x) => model.id.includes(x)), -2],
    ["fast model preference", type === "fast" && FastModelPreferences.some((x) => model.id.includes(x)), 2],
    ["low cost", type === "fast" && isLowCost(model), 1]
  ];
  for (const rule in boosts) {
    if (model.ref.includes(rule)) {
      scores.push([`boost (${rule})`, true, Number(boosts[rule]) ?? 0]);
    }
  }
  for (const [, condition, value] of scores) {
    if (condition) {
      score += value;
    }
  }
  return score;
};
var getBestModels = (models2, boosts = {}) => models2.sort((a, b) => scoreModel(b, "best", boosts) - scoreModel(a, "best", boosts));
var getFastModels = (models2, boosts = {}) => models2.sort((a, b) => scoreModel(b, "fast", boosts) - scoreModel(a, "fast", boosts));
var pickModel = (models2, downtimes = []) => {
  const copy = [...models2];
  const elasped = (date) => (/* @__PURE__ */ new Date()).getTime() - new Date(date).getTime();
  const DOWNTIME_THRESHOLD = 1000 * 60 * DOWNTIME_THRESHOLD_MINUTES;
  if (!copy.length) {
    throw new Error("At least one model is required");
  }
  while (copy.length) {
    const ref = copy.shift();
    const downtime = downtimes.find((o) => o.ref === ref && elasped(o.startedAt) < DOWNTIME_THRESHOLD);
    if (downtime) {
      continue;
    } else {
      return ref;
    }
  }
  throw new Error(`All models are down: ${models2.join(", ")}`);
};
var ModelProvider = class {
};
var RemoteModelProvider = class extends ModelProvider {
  _client;
  constructor(client) {
    super();
    this._client = getExtendedClient(client);
  }
  async _fetchInstalledIntegrationNames() {
    try {
      const { bot } = await this._client.getBot({ id: this._client.botId });
      const integrations = Object.values(bot.integrations).filter((x) => x.status === "registered");
      return integrations.map((x) => x.name);
    } catch (err) {
      if (isForbiddenOrUnauthorizedError(err)) {
        return DEFAULT_INTEGRATIONS;
      }
      throw err;
    }
  }
  async fetchInstalledModels() {
    const integrationNames = await this._fetchInstalledIntegrationNames();
    const models2 = [];
    await Promise.allSettled(integrationNames.map(async (integration) => {
      const { output } = await this._client.callAction({
        type: `${integration}:listLanguageModels`,
        input: {}
      });
      if (!output?.models?.length) {
        return;
      }
      for (const model of output.models) {
        if (model.name && model.id && model.input && model.tags) {
          models2.push({
            ref: `${integration}:${model.id}`,
            integration,
            id: model.id,
            name: model.name,
            description: model.description,
            input: model.input,
            output: model.output,
            tags: model.tags
          });
        }
      }
    }));
    return models2;
  }
  async fetchModelPreferences() {
    try {
      const { file } = await this._client.getFile({ id: this._preferenceFileKey });
      if (globalThis.fetch !== undefined) {
        const response = await fetch(file.url);
        return await response.json();
      } else {
        const { data } = await this._client.axios.get(file.url, {
          headers: Object.keys(this._client.config.headers).reduce((acc, key) => {
            acc[key] = undefined;
            return acc;
          }, {})
        });
        return data;
      }
    } catch (err) {
      if (isNotFoundError(err)) {
        return null;
      }
      throw err;
    }
  }
  async saveModelPreferences(preferences) {
    await this._client.uploadFile({
      key: this._preferenceFileKey,
      content: JSON.stringify(preferences, null, 2),
      index: false,
      tags: {
        system: "true",
        purpose: "config"
      }
    });
  }
  async deleteModelPreferences() {
    await this._client.deleteFile({ id: this._preferenceFileKey }).catch(() => {});
  }
  get _preferenceFileKey() {
    return `bot->${this._client.botId}->${PREFERENCES_FILE_SUFFIX}`;
  }
};
var Cognitive = class _Cognitive {
  ["$$IS_COGNITIVE"] = true;
  static isCognitiveClient(obj) {
    return obj?.$$IS_COGNITIVE === true;
  }
  interceptors = {
    request: new InterceptorManager,
    response: new InterceptorManager
  };
  _models = [];
  _timeoutMs = 5 * 60 * 1000;
  _maxRetries = 5;
  _client;
  _preferences = null;
  _provider;
  _downtimes = [];
  _useBeta = false;
  _debug = false;
  _remoteModelCache = /* @__PURE__ */ new Map;
  _remoteModelCacheTime = 0;
  _remoteModelCachePending = null;
  _events = createNanoEvents();
  constructor(props) {
    this._client = getExtendedClient(props.client);
    this._provider = props.provider ?? new RemoteModelProvider(props.client);
    this._timeoutMs = props.timeout ?? this._timeoutMs;
    this._maxRetries = props.maxRetries ?? this._maxRetries;
    this._useBeta = props.__experimental_beta ?? false;
  }
  get client() {
    return this._client;
  }
  clone() {
    const copy = new _Cognitive({
      client: this._client.clone(),
      provider: this._provider,
      timeout: this._timeoutMs,
      maxRetries: this._maxRetries,
      __debug: this._debug,
      __experimental_beta: this._useBeta
    });
    copy._models = [...this._models];
    copy._preferences = this._preferences ? { ...this._preferences } : null;
    copy._downtimes = [...this._downtimes];
    copy._remoteModelCache = new Map(this._remoteModelCache);
    copy._remoteModelCacheTime = this._remoteModelCacheTime;
    copy._remoteModelCachePending = null;
    copy.interceptors.request = this.interceptors.request;
    copy.interceptors.response = this.interceptors.response;
    return copy;
  }
  on(event, cb) {
    return this._events.on(event, cb);
  }
  async fetchInstalledModels() {
    if (!this._models.length) {
      this._models = await this._provider.fetchInstalledModels();
    }
    return this._models;
  }
  async fetchPreferences() {
    if (this._preferences) {
      return this._preferences;
    }
    this._preferences = await this._provider.fetchModelPreferences();
    if (this._preferences) {
      return this._preferences;
    }
    const models2 = await this.fetchInstalledModels();
    this._preferences = {
      best: getBestModels(models2).map((m) => m.ref),
      fast: getFastModels(models2).map((m) => m.ref),
      downtimes: []
    };
    await this._provider.saveModelPreferences(this._preferences);
    return this._preferences;
  }
  async setPreferences(preferences, save = false) {
    this._preferences = preferences;
    if (save) {
      await this._provider.saveModelPreferences(preferences);
    }
  }
  _cleanupOldDowntimes() {
    const now = Date.now();
    const thresholdMs = 1000 * 60 * DOWNTIME_THRESHOLD_MINUTES;
    this._preferences.downtimes = this._preferences.downtimes.filter((downtime) => {
      const downtimeStart = new Date(downtime.startedAt).getTime();
      return now - downtimeStart <= thresholdMs;
    });
  }
  _getPrimaryModel(input) {
    return Array.isArray(input.model) ? input.model[0] : input.model;
  }
  async _selectModel(ref) {
    const parseRef = (ref2) => {
      const parts = ref2.split(":");
      return { integration: parts[0], model: parts.slice(1).join(":") };
    };
    const preferences = await this.fetchPreferences();
    preferences.best ??= [];
    preferences.fast ??= [];
    preferences.downtimes ??= [];
    const downtimes = [...preferences.downtimes, ...this._downtimes ?? []];
    if (ref === "best" || ref === "auto") {
      return parseRef(pickModel(preferences.best, downtimes));
    }
    if (ref === "fast") {
      return parseRef(pickModel(preferences.fast, downtimes));
    }
    return parseRef(pickModel([ref, ...preferences.best, ...preferences.fast], downtimes));
  }
  async fetchRemoteModels() {
    if (this._remoteModelCacheTime > 0 && Date.now() - this._remoteModelCacheTime < 60 * 60 * 1000) {
      return this._remoteModelCache;
    }
    if (this._remoteModelCachePending !== null) {
      return this._remoteModelCachePending;
    }
    this._remoteModelCachePending = this._doFetchRemoteModels().finally(() => {
      this._remoteModelCachePending = null;
    });
    return this._remoteModelCachePending;
  }
  async _doFetchRemoteModels() {
    const betaClient = new CognitiveBeta2(this._client.config);
    const remoteModels = await betaClient.listModels();
    this._remoteModelCache.clear();
    this._remoteModelCacheTime = Date.now();
    for (const m of remoteModels) {
      const converted = { ...m, ref: m.id, integration: "cognitive-v2" };
      this._remoteModelCache.set(m.id, converted);
      if (m.aliases) {
        for (const alias of m.aliases) {
          this._remoteModelCache.set(alias, converted);
        }
      }
    }
    return this._remoteModelCache;
  }
  async getModelDetails(model) {
    if (this._useBeta) {
      const resolvedModel = getCognitiveV2Model(model);
      if (resolvedModel) {
        return { ...resolvedModel, ref: resolvedModel.id, integration: "cognitive-v2" };
      }
      if (isKnownV2Model(model)) {
        try {
          const remoteModels = await this.fetchRemoteModels();
          const found = remoteModels.get(model);
          if (found) {
            return found;
          }
        } catch {}
      }
    }
    await this.fetchInstalledModels();
    const { integration, model: modelName } = await this._selectModel(model);
    const def = this._models.find((m) => m.integration === integration && (m.name === modelName || m.id === modelName));
    if (!def) {
      throw new Error(`Model ${modelName} not found`);
    }
    return def;
  }
  async generateContent(input) {
    const primaryInputModel = this._getPrimaryModel(input);
    if (!this._useBeta || !isKnownV2Model(primaryInputModel)) {
      return this._generateContent(input);
    }
    try {
      return await this._generateContentV2(input);
    } catch (err) {
      if (input.signal?.aborted) {
        throw err;
      }
      return this._generateContent(input);
    }
  }
  async _generateContentV2(input) {
    const v2Input = { ...input, messages: [...input.messages] };
    if (v2Input.systemPrompt) {
      v2Input.messages.unshift({ role: "system", content: v2Input.systemPrompt });
      delete v2Input.systemPrompt;
    }
    const betaClient = new CognitiveBeta2(this._client.config);
    const props = { input };
    betaClient.on("request", () => {
      this._events.emit("request", props);
    });
    betaClient.on("error", (_req, error) => {
      this._events.emit("error", props, error);
    });
    betaClient.on("retry", (_req, error) => {
      this._events.emit("retry", props, error);
    });
    const response = await betaClient.generateText(v2Input, {
      signal: input.signal,
      timeout: this._timeoutMs
    });
    const result = buildResponseFromBetaMetadata(response.output, response.metadata);
    this._events.emit("response", props, result);
    return result;
  }
  async _generateContent(input) {
    const start = Date.now();
    const signal = input.signal ?? AbortSignal.timeout(this._timeoutMs);
    const client = this._client.abortable(signal);
    const primaryInputModel = this._getPrimaryModel(input);
    let props = { input };
    let integration;
    let model;
    this._events.emit("request", props);
    const { output, meta } = await (0, import_exponential_backoff2.backOff)(async () => {
      const selection = await this._selectModel(primaryInputModel ?? "best");
      integration = selection.integration;
      model = selection.model;
      props = await this.interceptors.request.run({ input }, signal);
      return client.callAction({
        type: `${integration}:generateContent`,
        input: {
          ...props.input,
          model: { id: model }
        }
      });
    }, {
      retry: async (err, _attempt) => {
        if (signal?.aborted) {
          this._events.emit("aborted", props, err);
          signal.throwIfAborted();
          return false;
        }
        if (_attempt > this._maxRetries) {
          this._events.emit("error", props, err);
          return false;
        }
        const action = getActionFromError(err);
        if (action === "abort") {
          this._events.emit("error", props, err);
          return false;
        }
        if (action === "fallback") {
          this._downtimes.push({
            ref: `${integration}:${model}`,
            startedAt: (/* @__PURE__ */ new Date()).toISOString(),
            reason: "Model is down"
          });
          this._cleanupOldDowntimes();
          await this._provider.saveModelPreferences({
            ...this._preferences ?? { best: [], downtimes: [], fast: [] },
            downtimes: [...this._preferences.downtimes ?? [], ...this._downtimes ?? []]
          });
          this._events.emit("fallback", props, err);
          return true;
        }
        this._events.emit("retry", props, err);
        return true;
      }
    });
    const response = {
      output,
      meta: {
        cached: meta.cached ?? false,
        model: { integration, model },
        latency: Date.now() - start,
        cost: { input: output.usage.inputCost, output: output.usage.outputCost },
        tokens: { input: output.usage.inputTokens, output: output.usage.outputTokens }
      }
    };
    this._events.emit("response", props, response);
    return this.interceptors.response.run(response, signal);
  }
};
export { buildResponseFromBetaMetadata, cognitiveFromBeta, CognitiveBeta2, isKnownV2Model, getCognitiveV2Model, ModelProvider, RemoteModelProvider, Cognitive };