-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhorizon_beta_query.py
More file actions
40 lines (34 loc) · 1.16 KB
/
horizon_beta_query.py
File metadata and controls
40 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import requests
import json
# === CONFIGURATION ===
API_KEY = os.environ.get("OPENROUTER_API_KEY", "") # 🔑 Your OpenRouter API key
API_URL = "https://openrouter.ai/api/v1/chat/completions"
MODEL_ID = "openrouter/horizon-beta"
# === USER PROMPT ===
user_prompt = "What are the benefits of using Horizon Beta over GPT-4?"
# === PAYLOAD ===
payload = {
"model": MODEL_ID,
"messages": [
{"role": "system", "content": "You are Horizon Beta, an elite assistant responding with structured, clear, and concise outputs."},
{"role": "user", "content": user_prompt}
]
}
# === HEADERS ===
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# === SEND REQUEST ===
print("🚀 Querying Horizon Beta...")
response = requests.post(API_URL, headers=headers, json=payload)
# === HANDLE RESPONSE ===
if response.status_code == 200:
data = response.json()
message = data['choices'][0]['message']['content']
print("\n🤖 Horizon Beta says:\n")
print(message)
print("\n✅ Query completed successfully!")
else:
print(f"❌ Request failed with status code {response.status_code}")
print(response.text)