Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Shape the Future with Tooken!
这是我们认为最重要的 Web4 创新之一:让 AI 自己决定用什么模型、花多少钱。
# 给 Agent 100 USDC 的月预算,让它自主决定如何分配 agent = Agent( wallet=AgentWallet(budget_usdc=100), routing_policy={ "optimize_for": "cost_quality_balance", "task_model_mapping": { "text_processing": "auto-cheap", # 文本处理用便宜模型 "code_generation": "auto-quality", # 代码生成用高质量模型 "quick_qa": "auto-fast", # 快问快答用快速模型 "analysis": "claude-opus-4" # 分析任务指定 Opus } } ) # Agent 自主完成一系列任务 results = agent.run_pipeline([ {"task": "summarize_emails", "type": "text_processing"}, # → Kimi(便宜) {"task": "write_python_script", "type": "code_generation"}, # → Claude Opus(高质量) {"task": "answer_customer", "type": "quick_qa"}, # → Haiku(极快) {"task": "analyze_financials", "type": "analysis"}, # → Claude Opus(指定) ]) # 查看 Agent 的花费明细 print(agent.wallet.spending_report()) # 输出: # text_processing: 0.02 USDC (5 tasks) # code_generation: 0.45 USDC (3 tasks) # quick_qa: 0.01 USDC (8 tasks) # analysis: 0.38 USDC (2 tasks) # 总计: 0.86 USDC / 月预算 100 USDC