Skip to content

feat(experimental.generate): embeddings support for plugins #62794

Open

Description

@benn-herrera

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Proposal: add generate.embed to the experimental.generate API.

Embedding support would allow plugins to implement enhanced memory features (e.g. RAG-based document or git history comprehension)

generate.embed({ model, input: string[], dimensions?, purpose?: "query" | "document" })
  // → { embeddings: number[][], usage? }
  • An "embedding" model type next to "chat" | "decision" | "image".
  • Two wire formats: OpenAI-compatible POST /embeddings and Gemini batchEmbedContents.
  • purpose maps to Gemini's taskType and is ignored by OpenAI-compatible providers
  • Implementation parallels what was done for decisions API

I have a locally working prototype tested end to end through a plugin against a local OpenAI-compatible server running Qwen3-Embedding-8B

Surface area: ~580 mostly additive lines plus regenerated openapi.json and client code. ~470 in packages/ai, a few lines in every other package mirroring the decisions entry

I'd be happy to open a PR if this shape is acceptable.

Activity

  1. opencodejr commented on Nov 8, 2026

    @opencodejr
    Contributor

    Thanks for the detailed proposal, @benn-herrera! This asks for a generate.embed method on the experimental.generate API, with a new embedding model type and OpenAI-compatible and Gemini wire formats, so plugins can build memory or RAG features on top of OpenCode's configured providers.

    Right now v2 has no embedding support. Plugins get generate.text, generate.image and generate.decisions, and models.dev model types are limited to chat, decision and image. That means a plugin can't do this through OpenCode's providers today. Maintainers will look at whether this shape fits; since the API is experimental, it's worth waiting for their feedback on the design before opening the PR.

    Related issues:

  2. benn-herrera commented on Nov 11, 2026

    @benn-herrera
    Author

    Just saw the on-point PRs into dev - outstanding, thank you!
    Looking forward to putting it to good use.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions