import requests import json url = "https://gw2.oops.asia/v1/chat/completions" headers = { "Content-Type": "application/json", "Authorization": "Bearer sk-f5ba1acb1d61c39f754c28f19d0e6e1b7d8d9fda43ef812ce4e335b6c26eff01" } # 测试不同的请求格式 test_cases = [ { "name": "标准格式", "body": { "model": "gpt-5.4-mini", "messages": [{"role": "user", "content": "Say hi"}], "max_tokens": 20 } }, { "name": "带 temperature", "body": { "model": "gpt-5.4-mini", "messages": [{"role": "user", "content": "Say hi"}], "max_tokens": 20, "temperature": 0.3 } }, { "name": "带 stream", "body": { "model": "gpt-5.4-mini", "messages": [{"role": "user", "content": "Say hi"}], "max_tokens": 20, "stream": False } } ] for test in test_cases: print(f"\n测试: {test['name']}") try: response = requests.post(url, headers=headers, json=test["body"], timeout=10) print(f" 状态码: {response.status_code}") print(f" 响应: {response.text[:200]}") except Exception as e: print(f" 错误: {e}")