variant-source-plugin.ts 907 B

12345678910111213141516171819202122232425262728
  1. import { Plugin } from "@opencode-ai/plugin/effect"
  2. import { Model } from "@opencode-ai/core/model"
  3. import { Provider } from "@opencode-ai/core/provider"
  4. import { Effect } from "effect"
  5. export default Plugin.define({
  6. id: "variant-source",
  7. effect: (ctx) =>
  8. ctx.catalog
  9. .transform((catalog) => {
  10. catalog.provider.update("configured", (provider) => {
  11. provider.package = Provider.aisdk("@ai-sdk/openai-compatible")
  12. })
  13. catalog.model.update("configured", "glm-5.2", (model) => {
  14. model.modelID = Model.ID.make("glm-5.2")
  15. model.package = Provider.aisdk("@ai-sdk/openai-compatible")
  16. model.variants = [
  17. {
  18. id: Model.VariantID.make("high"),
  19. settings: {},
  20. headers: { custom: "true" },
  21. body: {},
  22. },
  23. ]
  24. })
  25. })
  26. .pipe(Effect.asVoid),
  27. })