Skip to content

Request to support Dynamic API keys through an apiKeyHelper #1302

@mvalkon

Description

@mvalkon

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

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