anomalyco / anomalyco/opencode

[FEATURE]: Plugin-safe raw text generation

Open
#39,243 2 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Jul 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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

Plugins that need a small isolated model call currently have to use client.session.prompt(). That creates a session and runs the normal agent pipeline, adding base prompts, project instructions, tools and context. A plugin-safe raw generation API should reuse OpenCode's provider authentication and model configuration while sending only an explicit system prompt and user prompt.

Suggested contract:

await client.experimental.generateText({
  query: { directory },
  body: {
    model: { providerID, modelID, variant },
    system: "You are a professional translator. Output only the translation.",
    prompt: "Translate this text...",
    temperature: 0,
    maxOutputTokens: 2048,
  },
})

Requirements:

  • Reuse existing provider resolution, API keys, OAuth, endpoints, variants, retries and timeouts.
  • Exclude session history, agent prompts, project instructions, tools, skills, MCP context and plugin system transforms unless explicitly requested.
  • Do not create or persist sessions/messages.
  • Do not expose credential material to plugins.
  • Return generated text, usage and typed provider errors.

This would let translation and similar plugins make a minimal model request without requiring duplicate credentials or paying for unrelated OpenCode context.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.