fix(offers): support Claude OAuth token (citti/claude_oauth_token)
The key was provisioned as an OAuth token, not an API key. Read it from Consul into ANTHROPIC_AUTH_TOKEN (the SDK uses it as a Bearer credential) and add the required anthropic-beta: oauth-2025-04-20 header on the messages calls. Credential guards now accept a key or a token. The job no longer sets ANTHROPIC_API_KEY, since even an empty value would shadow the token.
This commit is contained in:
13
citti.nomad
13
citti.nomad
@@ -97,14 +97,15 @@ job "citti" {
|
||||
HOST = "0.0.0.0"
|
||||
}
|
||||
|
||||
# Claude key for DA translation + AI offer matching (same account as
|
||||
# BlaaAi). Use citti's own Consul key if set, else fall back to the
|
||||
# existing blaaai/anthropic_api_key. `or` keeps it empty (not a deploy
|
||||
# failure) if neither exists — offers then stay German with heuristic
|
||||
# matching.
|
||||
# Claude OAuth token for DA translation + AI offer matching. Set as
|
||||
# ANTHROPIC_AUTH_TOKEN (the SDK reads it as a Bearer token); the app adds
|
||||
# the required anthropic-beta: oauth-2025-04-20 header. We deliberately do
|
||||
# NOT set ANTHROPIC_API_KEY — even an empty value would shadow the token.
|
||||
# keyOrDefault keeps it empty (not a deploy failure) if the KV is unset —
|
||||
# offers then stay German with heuristic matching.
|
||||
template {
|
||||
data = <<EOT
|
||||
ANTHROPIC_API_KEY={{ or (keyOrDefault "citti/anthropic_api_key" "") (keyOrDefault "blaaai/anthropic_api_key" "") }}
|
||||
ANTHROPIC_AUTH_TOKEN={{ keyOrDefault "citti/claude_oauth_token" "" }}
|
||||
EOT
|
||||
destination = "secrets/app.env"
|
||||
env = true
|
||||
|
||||
Reference in New Issue
Block a user