1
0

variant-source-plugin.ts 831 B

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