opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Request to support Dynamic API keys through an apiKeyHelper

Open mvalkon opened this issue 5 months ago • 5 comments

Feature Request: Support Dynamic API Keys with apiKeyHelper

Add support for rotating JWT tokens or API keys by allowing users to configure a helper script in their configuration which opencode can then call to refresh a token based on a configurable refresh interval time.

Problem

Currently, opencode only supports static API keys. This creates friction for users who integrate to models via, for example, a liteLLM proxy using rotating tokens or api keys with short expiration times.

Requested Feature

Support an apiKeyHelper configuration option that executes a user-defined script to generate API keys dynamically, and accepts a token refresh interval as configuration via the config files and/or env vars.

Reference

Claude Code implements this feature as explained here https://docs.anthropic.com/en/docs/claude-code/llm-gateway#litellm-configuration

mvalkon avatar Jul 25 '25 08:07 mvalkon