From c1b4466ad71482fe02285d4230dc794b2e045a3c Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Fri, 19 Sep 2025 08:44:33 -0600 Subject: [PATCH] Add `HTTP-Referer` and `X-Title` to requests for OpenRouter tracking. --- ask | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ask b/ask index 14b4eb4..3c8b5f7 100755 --- a/ask +++ b/ask @@ -152,6 +152,8 @@ if [ "$STREAMING" = true ]; then curl -sS "$API_URL" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ + -H "HTTP-Referer: https://github.com/kagisearch/ask/" \ + -H "X-Title: Kagi ask" \ -d "$JSON_PAYLOAD" 2>&1 | while IFS= read -r line; do # Check for errors if echo "$line" | grep -q '"error"'; then @@ -179,6 +181,8 @@ else response=$(curl -sS "$API_URL" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ + -H "HTTP-Referer: https://github.com/kagisearch/ask/" \ + -H "X-Title: Kagi ask" \ -d "$JSON_PAYLOAD" 2>&1) # Check for errors