Add Anthropic API key secret and env var to Soma Cloud Run
Provisions soma-anthropic-api-key in Secret Manager and injects it as ANTHROPIC_API_KEY into the Cloud Run service. Also sets ANTHROPIC_MODEL to claude-sonnet-4-5. Soma's chat handler now uses this to route the neuron model to Anthropic instead of spinning up GPU VMs.
This commit is contained in:
@@ -153,6 +153,20 @@ resource "google_secret_manager_secret_version" "soma_key_secret" {
|
|||||||
secret_data = "neuron-soma-key-secret-2026-change-me"
|
secret_data = "neuron-soma-key-secret-2026-change-me"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "google_secret_manager_secret" "soma_anthropic_api_key" {
|
||||||
|
secret_id = "soma-anthropic-api-key"
|
||||||
|
project = var.project_id
|
||||||
|
|
||||||
|
replication {
|
||||||
|
auto {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_secret_manager_secret_version" "soma_anthropic_api_key" {
|
||||||
|
secret = google_secret_manager_secret.soma_anthropic_api_key.id
|
||||||
|
secret_data = "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"
|
||||||
|
}
|
||||||
|
|
||||||
# ── Cloud Run Service — us-central1 ──────────────────────────────────────────
|
# ── Cloud Run Service — us-central1 ──────────────────────────────────────────
|
||||||
|
|
||||||
resource "google_cloud_run_v2_service" "soma_us" {
|
resource "google_cloud_run_v2_service" "soma_us" {
|
||||||
@@ -248,6 +262,31 @@ resource "google_cloud_run_v2_service" "soma_us" {
|
|||||||
value = "https://ai.neurontechnologies.ai"
|
value = "https://ai.neurontechnologies.ai"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
# vLLM backend — RunPod pod Neuron-R1 (DeepSeek-R1-Distill-Llama-70B).
|
||||||
|
# Update to a new pod ID when the RunPod pod is cycled.
|
||||||
|
name = "LLM_BACKEND_URL"
|
||||||
|
value = "https://08axh3kk1oatu2-19123.proxy.runpod.net"
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
# Anthropic API key — when set, soma routes chat completions to Anthropic
|
||||||
|
# instead of trying to provision a GCE GPU node.
|
||||||
|
name = "ANTHROPIC_API_KEY"
|
||||||
|
value_source {
|
||||||
|
secret_key_ref {
|
||||||
|
secret = google_secret_manager_secret.soma_anthropic_api_key.secret_id
|
||||||
|
version = "latest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
# Anthropic model to use for the "neuron" model alias.
|
||||||
|
name = "ANTHROPIC_MODEL"
|
||||||
|
value = "claude-sonnet-4-5"
|
||||||
|
}
|
||||||
|
|
||||||
ports {
|
ports {
|
||||||
container_port = 8080
|
container_port = 8080
|
||||||
name = "http1"
|
name = "http1"
|
||||||
@@ -291,6 +330,7 @@ resource "google_cloud_run_v2_service" "soma_us" {
|
|||||||
google_secret_manager_secret_version.soma_operator_key,
|
google_secret_manager_secret_version.soma_operator_key,
|
||||||
google_secret_manager_secret_version.soma_node_secret,
|
google_secret_manager_secret_version.soma_node_secret,
|
||||||
google_secret_manager_secret_version.soma_key_secret,
|
google_secret_manager_secret_version.soma_key_secret,
|
||||||
|
google_secret_manager_secret_version.soma_anthropic_api_key,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user