对比直接使用官方 API 与通过 Taotoken 接入的成本体感
2026/5/10 18:12:37
#!/usr/bin/env python3 """测试 Gateway 返回值 运行方式: 方式1(推荐): python -m gateway.example 方式2: cd .. && python gateway/example.py """ import asyncio import json import sys from pathlib import Path # 支持直接运行和模块运行两种方式 try: from .caller import call_gateway except ImportError: sys.path.insert(0, str(Path(__file__).parent)) from caller import call_gateway async def test(): print("[*] 调用 Gateway...") result = await call_gateway('零食', timeout=15) print(f"\n[+] 返回类型: {type(result)}") print(f"[+] 返回键: {list(result.keys()) if isinstance(result, dict) else 'N/A'}") print(f"[+] 返回值: {result}") return result if __name__ == "__main__": result = asyncio.run(test()) print("\n[*] 测试完成,程序已退出")