Skip to content

Commit 9b27a9f

Browse files
committed
fix: read OPENCODE_API_KEY for anthropic provider
1 parent aff73b2 commit 9b27a9f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

provider.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ func NewProvider(providerName string, apiKey ...string) (Provider, error) {
6767

6868
case "anthropic":
6969
key := providedKey
70+
if key == "" {
71+
key = os.Getenv("OPENCODE_API_KEY")
72+
}
7073
if key == "" {
7174
key = os.Getenv("ANTHROPIC_API_KEY")
7275
}
7376
if key == "" {
74-
return nil, fmt.Errorf("ANTHROPIC_API_KEY is required for anthropic provider (or use --api-key)")
77+
return nil, fmt.Errorf("OPENCODE_API_KEY is required for anthropic provider (or use --api-key)")
7578
}
7679
return NewAnthropic(AnthropicConfig{
7780
Model: getEnvOr("ITERATE_MODEL", "claude-sonnet-4-6"),

0 commit comments

Comments
 (0)