Support OAuth tokens (sk-ant-oat*) with Bearer auth
This commit is contained in:
parent
3ccce3eae6
commit
911bfe78b1
@ -28,6 +28,14 @@ class AnthropicProvider(BaseProvider):
|
|||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
"""Generate response using Anthropic Messages API"""
|
"""Generate response using Anthropic Messages API"""
|
||||||
|
|
||||||
|
# OAuth tokens (sk-ant-oat*) use Bearer auth, regular keys use x-api-key
|
||||||
|
if self.api_key.startswith("sk-ant-oat"):
|
||||||
|
headers = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Authorization": f"Bearer {self.api_key}",
|
||||||
|
"anthropic-version": self.anthropic_version
|
||||||
|
}
|
||||||
|
else:
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"x-api-key": self.api_key,
|
"x-api-key": self.api_key,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user