Last active
December 5, 2025 04:42
-
-
Save coverband/87f43ee9bd466285efae8301d7b3555c to your computer and use it in GitHub Desktop.
This is a small python utility that will get a list of all blackbox.ai models that are supposed to be accessible to you, and do a quick test call with each to figure out which ones ACTUALLY work. Many models are listed by blackbox.ai, but unfortunately a large number of them are not actually accessible, some due to API rate throttling by the pro…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # --------------------------------------------- | |
| # This is a small python utility that will get a list of all blackbox.ai models that are supposed to be accessible to you, | |
| # and do a quick test call with each to figure out which ones ACTUALLY work. Many models are listed by blackbox.ai, but unfortunately | |
| # a large number of them are not actually accessible, some due to API rate throttling by the provider, some due to the provider asking | |
| # you to accept their terms/policies before granting access, and some due to incorrect path/documentation/version by blackbox.ai . | |
| # --------------------------------------------- | |
| import requests | |
| import json | |
| import time | |
| # --------------------------------------------- | |
| # CONFIG | |
| # --------------------------------------------- | |
| BLACKBOX_API_KEY = "YOUR_BLACKBOX_API_KEY_HERE" | |
| BASE_URL = "https://api.blackbox.ai/v1" | |
| TEST_MESSAGE = "Respond with only: OK" | |
| TIMEOUT = 12 # seconds for each model call | |
| PAUSE_BETWEEN_CALLS = 0.4 # avoid rate limits | |
| # --------------------------------------------- | |
| headers = { | |
| "Authorization": f"Bearer {BLACKBOX_API_KEY}", | |
| "Content-Type": "application/json" | |
| } | |
| def get_models(): | |
| """Fetch the list of available models from Blackbox.""" | |
| print("Fetching model list...\n") | |
| url = f"{BASE_URL}/models" | |
| resp = requests.get(url, headers=headers) | |
| if resp.status_code != 200: | |
| print("ERROR retrieving models:", resp.status_code, resp.text) | |
| return [] | |
| data = resp.json() | |
| models = data.get("data", data.get("models", [])) # handle variations | |
| print(f"Found {len(models)} models.\n") | |
| return models | |
| def test_model(model_id): | |
| """Send a small test message to a given model.""" | |
| url = f"{BASE_URL}/chat/completions" | |
| payload = { | |
| "model": model_id, | |
| "messages": [ | |
| {"role": "user", "content": TEST_MESSAGE} | |
| ] | |
| } | |
| try: | |
| resp = requests.post(url, headers=headers, json=payload, timeout=TIMEOUT) | |
| if resp.status_code == 200: | |
| return True, resp.json() | |
| else: | |
| return False, f"HTTP {resp.status_code}: {resp.text}" | |
| except Exception as e: | |
| return False, str(e) | |
| def main(): | |
| models = get_models() | |
| if not models: | |
| print("No models found — stopping.") | |
| return | |
| working = [] | |
| failing = [] | |
| for m in models: | |
| model_id = m.get("id") or m.get("name") # Blackbox may use "id" or "name" | |
| print(f"Testing model: {model_id} ...") | |
| ok, result = test_model(model_id) | |
| if ok: | |
| print(f" ✔ SUCCESS") | |
| working.append(model_id) | |
| else: | |
| print(f" ✖ FAILED — {result}") | |
| failing.append((model_id, result)) | |
| time.sleep(PAUSE_BETWEEN_CALLS) | |
| # --------------------------------------------- | |
| # Summary | |
| # --------------------------------------------- | |
| print("\n\n=========== TEST SUMMARY ===========\n") | |
| print("✔ Working models:") | |
| for w in working: | |
| print(" -", w) | |
| print("\n✖ Failing models:") | |
| for f, err in failing: | |
| print(f" - {f}: {err}") | |
| print("\n====================================\n") | |
| if __name__ == "__main__": | |
| main() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Admittedly, I've used ChatGPT's help to come up with the script...