| | import os |
| | import requests |
| |
|
| | |
| | api_key = os.environ.get("key", "") |
| | print(f"1. API Key loaded: {'Yes' if api_key else 'No'}") |
| | print(f"2. Key length: {len(api_key)}") |
| | print(f"3. First 4 chars: {api_key[:4] if api_key else 'None'}") |
| |
|
| | |
| | url = "https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks" |
| | headers = { |
| | "Content-Type": "application/json", |
| | "Authorization": f"Bearer {api_key}" |
| | } |
| |
|
| | |
| | data = { |
| | "model": "seedance-1-5-pro-251215", |
| | "content": [ |
| | { |
| | "type": "text", |
| | "text": "test" |
| | } |
| | ] |
| | } |
| |
|
| | print("\n4. Sending test request...") |
| | try: |
| | response = requests.post(url, headers=headers, json=data) |
| | print(f"5. Status code: {response.status_code}") |
| | print(f"6. Response: {response.text[:200]}") |
| | except Exception as e: |
| | print(f"5. Error: {e}") |
| |
|
| | print("\n7. Test complete") |