feat: Update AI API key header to use Bearer token format and clarify OpenAPI compatibility
This commit is contained in:
parent
079d3dd899
commit
1b6cf6e6e1
@ -173,7 +173,7 @@ class RedditClient:
|
|||||||
|
|
||||||
|
|
||||||
class AIClient:
|
class AIClient:
|
||||||
"""Client for interacting with AI API with retry logic"""
|
"""Client for interacting with OpenAPI AI API with retry logic"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.base_url = OLLAMA_BASE_URL
|
self.base_url = OLLAMA_BASE_URL
|
||||||
@ -201,8 +201,8 @@ class AIClient:
|
|||||||
"""
|
"""
|
||||||
for attempt in range(max_retries + 1):
|
for attempt in range(max_retries + 1):
|
||||||
try:
|
try:
|
||||||
# Add API key to headers
|
# Add API key to Authorization header as Bearer token
|
||||||
headers = {"x-api-key": self.api_key}
|
headers = {"Authorization": f"Bearer {self.api_key}"}
|
||||||
response = self.session.post(url, json=json_data, headers=headers, timeout=30)
|
response = self.session.post(url, json=json_data, headers=headers, timeout=30)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response
|
return response
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user