Public Access
MAJ Globale : Chemins absolus (NAS), Model Updater auto, Timeout 90s OpenRouter, Pop-up et traçabilité financière
Build and Push Docker Image / build-and-push (push) Successful in 1m48s
Build and Push Docker Image / build-and-push (push) Successful in 1m48s
This commit is contained in:
1 parent
b4ed2947d4
commit
632c23069a
9 files changed
+66
-89
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
import json
|
||||
|
||||
# Charge ta clé API depuis le fichier .env
|
||||
load_dotenv()
|
||||
api_key = os.getenv("OPENROUTER_API_KEY")
|
||||
|
||||
if not api_key:
|
||||
print("Erreur : Clé OPENROUTER_API_KEY introuvable dans le .env")
|
||||
exit()
|
||||
|
||||
print("🔍 Interrogation des serveurs OpenRouter...")
|
||||
|
||||
try:
|
||||
response = requests.get(
|
||||
"https://openrouter.ai/api/v1/auth/key",
|
||||
headers={"Authorization": f"Bearer {api_key}"}
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
print("\n✅ CONNEXION RÉUSSIE ! Voici le JSON de ton compte :")
|
||||
# Affiche le JSON formaté de manière lisible
|
||||
print(json.dumps(response.json(), indent=4))
|
||||
else:
|
||||
print(f"\n❌ ERREUR {response.status_code}: {response.text}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Erreur de connexion : {e}")
|
||||
Reference in new issue
Block a user