RayMelius Claude Sonnet 4.6 commited on
Commit
e1870c9
·
1 Parent(s): 5530b41

Fix HF 410: always use router.huggingface.co for all models

Browse files

api-inference.huggingface.co is deprecated (HTTP 410).
All three services (ai_analyst, ch_ai_trader, dashboard) now
route every model through router.huggingface.co.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

ai_analyst/ai_analyst.py CHANGED
@@ -90,10 +90,7 @@ def call_llm(prompt: str) -> str | None:
90
  if not HF_TOKEN:
91
  return None
92
  m = model or HF_MODEL
93
- if m.startswith("RayMelius/"):
94
- url = f"https://api-inference.huggingface.co/models/{m}/v1/chat/completions"
95
- else:
96
- url = "https://router.huggingface.co/v1/chat/completions"
97
  print(f"[AI-Analyst] Calling HF: model={m}")
98
  for attempt in range(3):
99
  try:
 
90
  if not HF_TOKEN:
91
  return None
92
  m = model or HF_MODEL
93
+ url = "https://router.huggingface.co/v1/chat/completions"
 
 
 
94
  print(f"[AI-Analyst] Calling HF: model={m}")
95
  for attempt in range(3):
96
  try:
clearing_house/ch_ai_trader.py CHANGED
@@ -434,10 +434,7 @@ def _try_groq(prompt: str) -> Optional[str]:
434
  def _try_hf(prompt: str) -> Optional[str]:
435
  if not HF_TOKEN:
436
  return None
437
- if HF_MODEL.startswith("RayMelius/"):
438
- url = f"https://api-inference.huggingface.co/models/{HF_MODEL}/v1/chat/completions"
439
- else:
440
- url = "https://router.huggingface.co/v1/chat/completions"
441
  try:
442
  resp = requests.post(
443
  url,
 
434
  def _try_hf(prompt: str) -> Optional[str]:
435
  if not HF_TOKEN:
436
  return None
437
+ url = "https://router.huggingface.co/v1/chat/completions"
 
 
 
438
  try:
439
  resp = requests.post(
440
  url,
dashboard/dashboard.py CHANGED
@@ -144,11 +144,7 @@ def _call_llm(prompt, force_provider=None, force_model=None):
144
  if not HF_TOKEN:
145
  return None, "HuggingFace not configured (HF_TOKEN not set)"
146
  m = model or HF_MODEL
147
- # Use direct inference API for any org/model format; router for bare model names
148
- if "/" in m:
149
- url = f"https://api-inference.huggingface.co/models/{m}/v1/chat/completions"
150
- else:
151
- url = HF_URL
152
  print(f"[Dashboard/LLM] Calling HF ({m})...")
153
  for attempt in range(3):
154
  try:
 
144
  if not HF_TOKEN:
145
  return None, "HuggingFace not configured (HF_TOKEN not set)"
146
  m = model or HF_MODEL
147
+ url = HF_URL
 
 
 
 
148
  print(f"[Dashboard/LLM] Calling HF ({m})...")
149
  for attempt in range(3):
150
  try: