Skip to content

[FEATURE]: Plugin-safe raw text generation #39243

Description

@CarmeloCampos

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.

Metadata

Metadata

Assignees

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