(logger)
| 312 | |
| 313 | |
| 314 | def fetch_hyperbolic_models(logger): |
| 315 | logger.info("Fetching Hyperbolic models from API...") |
| 316 | r = requests.get( |
| 317 | "https://api.hyperbolic.xyz/v1/models", |
| 318 | headers={ |
| 319 | "accept": "application/json", |
| 320 | "authorization": f"Bearer {os.environ['HYPERBOLIC_API_KEY']}", |
| 321 | }, |
| 322 | ) |
| 323 | r.raise_for_status() |
| 324 | models = r.json()["data"] |
| 325 | logger.info(f"Fetched {len(models)} models from Hyperbolic's API") |
| 326 | ret_models = [] |
| 327 | for model in models: |
| 328 | if model["id"] in HYPERBOLIC_IGNORED_MODELS: |
| 329 | logger.debug(f"Ignoring model {model['id']}") |
| 330 | continue |
| 331 | ret_models.append( |
| 332 | { |
| 333 | "id": model["id"], |
| 334 | "name": get_model_name(model["id"]), |
| 335 | "limits": { |
| 336 | "requests/minute": 60, |
| 337 | }, |
| 338 | } |
| 339 | ) |
| 340 | logger.debug(json.dumps(ret_models, indent=4)) |
| 341 | return sorted(ret_models, key=lambda x: x["name"]) |
| 342 | |
| 343 | |
| 344 | def fetch_github_models(logger): |
no test coverage detected