From f70cb64d3f8a5a43d627e0f6bb6916300d3dea4c Mon Sep 17 00:00:00 2001 From: Lee-Si-Yoon Date: Thu, 20 Aug 2026 13:13:33 +0000 Subject: [PATCH] feat(openrouter): forward session_id and add app category header (#10868) --- crates/goose/src/providers/openrouter.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/goose/src/providers/openrouter.rs b/crates/goose/src/providers/openrouter.rs index 052683a80..7c2bdc923 100644 --- a/crates/goose/src/providers/openrouter.rs +++ b/crates/goose/src/providers/openrouter.rs @@ -65,7 +65,8 @@ impl OpenRouterProvider { let api_client = ApiClient::new_with_tls(host, auth, tls_config)? .with_request_builder(crate::session_context::session_id_request_builder()) .with_header("HTTP-Referer", "https://goose-docs.ai")? - .with_header("X-Title", "goose")?; + .with_header("X-Title", "goose")? + .with_header("X-OpenRouter-Categories", "cli-agent,productivity")?; Ok(Self { api_client, @@ -276,10 +277,13 @@ impl Provider for OpenRouterProvider { true, )?; - // Add user field for OpenRouter attribution/rate-limiting if !session_id.is_empty() { if let Some(obj) = payload.as_object_mut() { obj.insert("user".to_string(), Value::String(session_id.to_string())); + obj.insert( + "session_id".to_string(), + Value::String(session_id.to_string()), + ); } }