import os import httpx import asyncio from dotenv import load_dotenv load_dotenv() API_KEY = os.getenv("RUNWAY_API_KEY", "key_430c19c118e875e80f3d80a21f0c1bd2d20c7863868b189c28312ae7589d3e99d0d6c466a05200a418910a855a0acb64e85491f2355a7fa82fa87ddb93baff86") print(f"Testing Runway API with Key: {API_KEY[:10]}...{API_KEY[-5:]}") async def test_endpoint(url, label): print(f"\n--- Testing {label} ({url}) ---") headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json", "X-Runway-Version": "2024-11-06" } # Based on error message, these are the only valid models models_to_test = [ "gen4.5", "gen3a_turbo" ] async with httpx.AsyncClient() as client: for model in models_to_test: print(f"\nProbing Model: {model}") payload = { "model": model, "promptText": "A simple test video of a cat", "duration": 5, "ratio": "1280:720" } try: response = await client.post(f"{url}/text_to_video", headers=headers, json=payload) print(f"Status: {response.status_code}") print(f"Response: {response.text}") if response.status_code == 200: print(f"!!! SUCCESS with model: {model} !!!") break except Exception as e: print(f"Exception: {e}") async def main(): await test_endpoint("https://api.dev.runwayml.com/v1", "Development") if __name__ == "__main__": asyncio.run(main())