feat(openrouter): forward session_id and add app category header (#10868)

This commit is contained in:
Lee-Si-Yoon
2026-08-20 13:13:33 +00:00
committed by GitHub
parent 3dd0762f96
commit f70cb64d3f
+6 -2
View File
@@ -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()),
);
}
}