Anthropic's Messages API: /v1/messages translated to chat completions and back, streamed or not, with tools and images; keys in x-api-key

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 22:59:55 +02:00
1 parent 9136bc71c2
commit e502996198
8 files changed
+769 -2

No files matched your search

+5 -1
View File
@@ -314,5 +314,9 @@ func BearerToken(r *http.Request) string {
// A bare value is common enough in hand-written clients to accept.
return strings.TrimSpace(h)
}
return strings.TrimSpace(r.Header.Get("api-key"))
if k := r.Header.Get("api-key"); k != "" {
return strings.TrimSpace(k)
}
// Anthropic's clients send their key here.
return strings.TrimSpace(r.Header.Get("x-api-key"))
}