Files
mystuff/devel/crush/patches/patch-internal_config_config_go
2026-07-08 18:38:17 +02:00

31 lines
888 B
Plaintext

Index: internal/config/config.go
--- internal/config/config.go.orig
+++ internal/config/config.go
@@ -178,6 +178,26 @@ func (c *ProviderConfig) SetupGitHubCopilot() {
maps.Copy(c.ExtraHeaders, copilot.Headers())
}
+func (c *ProviderConfig) SetupClaudeCode() {
+ c.FlatRate = true
+ c.SystemPromptPrefix = "You are Claude Code, Anthropic's official CLI for Claude."
+ if c.ExtraHeaders == nil {
+ c.ExtraHeaders = make(map[string]string)
+ }
+ c.ExtraHeaders["anthropic-version"] = "2023-06-01"
+ c.ExtraHeaders["User-Agent"] = "claude-code/2.1.112"
+ const want = "oauth-2025-04-20"
+ if v := c.ExtraHeaders["anthropic-beta"]; !strings.Contains(v, want) {
+ if v != "" {
+ v += ","
+ }
+ c.ExtraHeaders["anthropic-beta"] = v + want
+ }
+ if c.APIKey != "" && !strings.HasPrefix(c.APIKey, "Bearer ") {
+ c.APIKey = "Bearer " + c.APIKey
+ }
+}
+
type MCPType string
const (