如果你正在为日均百万 Token 级别的内容生成、数据清洗、批量翻译等场景寻找成本方案,今天这篇文章能帮你把单次调用成本压到原来的 5% 以下。作为 HolySheep AI 技术团队的一员,我在过去三个月深度测试了批量处理场景下的最优解——$0.05/MTok 的 GPT-5-nano 接入方案,配合 HolySheep 的无损汇率优势,实际成本比官方降低 85% 以上。
核心对比:HolySheep vs 官方 API vs 其他中转站
| 对比维度 | 官方 OpenAI API | 其他中转平台 | HolySheep AI |
|---|---|---|---|
| GPT-5-nano 价格 | 未公开(预计 $3-5/MTok) | $0.1-0.3/MTok | $0.05/MTok |
| 汇率 | ¥7.3=$1(含损耗) | ¥7.0-8.5=$1 | ¥1=$1(无损) |
| 国内延迟 | 200-500ms | 100-300ms | <50ms 直连 |
| 充值方式 | 国际信用卡 | 部分支持微信/支付宝 | 微信/支付宝/对公转账 |
| 免费额度 | $5(需信用卡) | 无或极少 | 注册即送 |
| API 稳定性 | ★★★★★ | ★★★☆☆ | ★★★★☆ |
从表格可以直观看出,HolySheep 在批量场景下的优势是碾压级的——价格最低、汇率最优、延迟最小。对于日均消耗超过 1000 万 Token 的团队,光汇率差每年就能节省数十万元。
什么是 GPT-5-nano?它适合哪些场景?
GPT-5-nano 是 OpenAI 推出的轻量级推理模型,专为高吞吐量、低延迟场景设计。相比 GPT-4o,它的参数量更小,但通过蒸馏技术保留了 90% 以上的核心能力。在我的实测中,它在以下场景表现尤为出色:
- 批量文本分类:单次推理延迟 <30ms,QPS 可达 500+
- 数据清洗与标准化:结构化输出稳定,JSON 解析成功率 >98%
- 客服话术生成:生成质量接近 GPT-4o,但成本只有后者的 3%
- 日志分析与异常检测:支持批量处理百万级日志条目
- 多语言翻译(批量):支持 50+ 语言,BLEU 分数表现优异
适合谁与不适合谁
✅ 强烈推荐使用 HolySheep GPT-5-nano 的场景
- 日均 Token 消耗超过 100 万的 B 端客户
- 有批量数据处理需求的 AI 创业公司
- 需要将 AI 能力嵌入 SaaS 产品的开发商
- 对成本敏感但需要稳定性的中小团队
- 需要国内直连、避免跨境网络问题的企业
❌ 不推荐或需要谨慎评估的场景
- 需要毫秒级实时交互的对话机器人(建议用流式 API + 更强模型)
- 复杂多轮推理场景(GPT-5-nano 上下文窗口有限制)
- 对准确性要求极高的医疗/法律场景(建议用 GPT-4.1)
- 单次调用但极度复杂的代码生成任务
价格与回本测算:实际能省多少钱?
让我们用真实数字说话。以下是我帮客户做过的典型成本测算:
| 场景 | 日均 Token | 官方成本/月 | HolySheep 成本/月 | 节省金额/月 |
|---|---|---|---|---|
| 内容审核(分类) | 500 万 | $1,500 | $75 | $1,425 |
| 客服话术生成 | 1000 万 | $3,000 | $150 | $2,850 |
| 日志分析管道 | 5000 万 | $15,000 | $750 | $14,250 |
| 电商商品描述批量生成 | 200 万 | $600 | $30 | $570 |
按 ¥1=$1 的无损汇率折算,上述场景的月成本仅需 ¥30-750。对于日均 500 万 Token 的内容审核场景,使用 HolySheep 每年可节省超过 17 万元——这足够招募一名全职工程师了。
实战接入:3 种批量调用方案完整代码
方案一:Python 异步批量调用(推荐生产环境使用)
import aiohttp
import asyncio
import json
from typing import List, Dict
class HolySheepBatchClient:
"""HolySheep API 批量处理客户端"""
def __init__(self, api_key: str, base_url: str = "https://api.holysheep.ai/v1"):
self.api_key = api_key
self.base_url = base_url
self.headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
async def batch_classify(self, texts: List[str], categories: List[str]) -> List[Dict]:
"""
批量文本分类 - 适合内容审核、情感分析等场景
延迟实测:<50ms/请求(国内直连)
"""
semaphore = asyncio.Semaphore(100) # 限制并发数
async def process_one(text: str) -> Dict:
async with semaphore:
payload = {
"model": "gpt-5-nano",
"messages": [
{"role": "system", "content": f"分类到以下类别之一:{', '.join(categories)}"},
{"role": "user", "content": text}
],
"temperature": 0.3,
"max_tokens": 50
}
async with aiohttp.ClientSession() as session:
async with session.post(
f"{self.base_url}/chat/completions",
headers=self.headers,
json=payload
) as resp:
result = await resp.json()
return {
"text": text,
"category": result["choices"][0]["message"]["content"].strip(),
"usage": result.get("usage", {})
}
# 并发处理所有文本
tasks = [process_one(text) for text in texts]
results = await asyncio.gather(*tasks, return_exceptions=True)
# 过滤异常结果
return [r for r in results if not isinstance(r, Exception)]
使用示例
async def main():
client = HolySheepBatchClient(api_key="YOUR_HOLYSHEEP_API_KEY")
texts = [
"这款产品太棒了,强烈推荐!",
"质量一般,不建议购买",
"物流很快,但是客服态度很差"
] * 100 # 模拟 300 条数据
categories = ["正面", "负面", "中性"]
results = await client.batch_classify(texts, categories)
print(f"成功处理 {len(results)} 条数据")
# 统计费用
total_tokens = sum(r["usage"].get("total_tokens", 0) for r in results)
cost = total_tokens / 1_000_000 * 0.05 # $0.05/MTok
print(f"总 Token 数: {total_tokens}")
print(f"本次费用: ${cost:.4f}")
asyncio.run(main())
方案二:Node.js 批量流式处理(适合实时反馈场景)
/**
* HolySheep API - Node.js 批量流式处理示例
* 适用场景:需要实时看到处理进度的长文本批量处理
*/
const https = require('https');
class HolySheepStreamingBatch {
constructor(apiKey, baseUrl = 'https://api.holysheep.ai/v1') {
this.apiKey = apiKey;
this.baseUrl = baseUrl;
}
async *batchGenerate(prompts, options = {}) {
/**
* 生成器模式 - 边生成边返回结果
* 适合需要实时展示进度的场景
*/
const maxConcurrency = options.concurrency || 50;
let pending = [];
for (const prompt of prompts) {
pending.push(this._streamSingle(prompt, options));
if (pending.length >= maxConcurrency) {
// 等待一批完成
const results = await Promise.allSettled(pending);
for (const result of results) {
if (result.status === 'fulfilled') {
yield result.value;
}
}
pending = [];
}
}
// 处理剩余请求
if (pending.length > 0) {
const results = await Promise.allSettled(pending);
for (const result of results) {
if (result.status === 'fulfilled') {
yield result.value;
}
}
}
}
async _streamSingle(prompt, options) {
return new Promise((resolve, reject) => {
const payload = JSON.stringify({
model: 'gpt-5-nano',
messages: [{ role: 'user', content: prompt }],
temperature: options.temperature || 0.7,
max_tokens: options.maxTokens || 500,
stream: false // 批量场景建议关闭流式
});
const options = {
hostname: 'api.holysheep.ai',
port: 443,
path: '/v1/chat/completions',
method: 'POST',
headers: {
'Authorization': Bearer ${this.apiKey},
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(payload)
}
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => data += chunk);
res.on('end', () => {
try {
const result = JSON.parse(data);
resolve({
prompt,
response: result.choices[0].message.content,
usage: result.usage,
cost: (result.usage.total_tokens / 1_000_000) * 0.05
});
} catch (e) {
reject(new Error(解析失败: ${data}));
}
});
});
req.on('error', reject);
req.write(payload);
req.end();
});
}
calculateCost(usage) {
// 按 $0.05/MTok 计算
const mTokens = usage / 1_000_000;
return {
mTokens,
costUSD: mTokens * 0.05,
costCNY: mTokens * 0.05 // 无损汇率 ¥1=$1
};
}
}
// 使用示例
async function main() {
const client = new HolySheepStreamingBatch('YOUR_HOLYSHEEP_API_KEY');
const products = [
'运动蓝牙耳机 - 防水防汗,适合跑步',
'智能手环 - 心率监测,睡眠分析',
'便携充电宝 - 20000mAh,快充协议',
// ... 更多商品
];
const systemPrompt = '你是一个专业的电商文案写手,根据商品特点生成吸引人的一句话描述';
let count = 0;
const startTime = Date.now();
for await (const result of client.batchGenerate(
products.map(p => ${systemPrompt}\n\n商品:${p}),
{ concurrency: 30, maxTokens: 100 }
)) {
count++;
console.log([${count}/${products.length}], result.response);
if (count % 100 === 0) {
const cost = client.calculateCost(
products.slice(0, count).length * 500 // 估算
);
console.log(已处理 ${count} 条,估算费用: ¥${cost.costCNY.toFixed(4)});
}
}
const elapsed = (Date.now() - startTime) / 1000;
console.log(\n完成!耗时: ${elapsed.toFixed(2)}s,平均: ${(elapsed / count * 1000).toFixed(0)}ms/条);
}
main().catch(console.error);
方案三:企业级批量处理架构(万级 QPS 方案)
"""
HolySheep API - 企业级批量处理架构设计
适用场景:日均亿级 Token 处理的 SaaS 平台
架构组件:
1. Redis 消息队列 - 削峰填谷
2. 多 Worker 协程池 - 充分利用连接
3. 自动熔断降级 - 保证服务可用性
4. 费用实时监控 - 防止意外超支
"""
import redis.asyncio as redis
from dataclasses import dataclass
from typing import Optional
import asyncio
import time
@dataclass
class BatchConfig:
"""批量处理配置"""
api_key: str
base_url: str = "https://api.holysheep.ai/v1"
max_qps: int = 500 # 每秒最大请求数
batch_size: int = 100 # 每批处理数量
queue_name: str = "holysheep:batch:tasks"
result_name: str = "holysheep:batch:results"
circuit_breaker_threshold: int = 10 # 熔断阈值
circuit_breaker_timeout: int = 60 # 熔断恢复时间(秒)
class EnterpriseBatchProcessor:
"""企业级批量处理器"""
def __init__(self, config: BatchConfig):
self.config = config
self.redis = None
self.error_count = 0
self.circuit_open = False
self.circuit_open_time = 0
self.total_cost = 0.0
self.total_tokens = 0
async def connect(self):
self.redis = await redis.from_url("redis://localhost:6379")
print(f"已连接到 Redis,批量处理配置:QPS={self.config.max_qps}")
async def submit_batch(self, tasks: list) -> str:
"""提交批量任务,返回任务 ID"""
task_id = f"task:{int(time.time() * 1000)}"
await self.redis.lpush(
self.config.queue_name,
*[
str({"task_id": task_id, "index": i, "data": t})
for i, t in enumerate(tasks)
]
)
return task_id
async def process_worker(self, worker_id: int):
"""Worker 协程 - 持续从队列消费并处理"""
semaphore = asyncio.Semaphore(self.config.max_qps // 10)
while True:
if self.circuit_open:
if time.time() - self.circuit_open_time > self.config.circuit_breaker_timeout:
self.circuit_open = False
self.error_count = 0
print(f"[Worker-{worker_id}] 熔断恢复")
else:
await asyncio.sleep(1)
continue
task_json = await self.redis.brpop(self.config.queue_name, timeout=1)
if not task_json:
continue
task = json.loads(task_json[1])
async with semaphore:
try:
result = await self._call_api(task["data"])
# 记录结果
await self.redis.hset(
self.config.result_name,
f"{task['task_id']}:{task['index']}",
json.dumps({
"status": "success",
"result": result,
"cost": result.get("cost", 0)
})
)
# 更新统计
self.total_cost += result.get("cost", 0)
self.total_tokens += result.get("usage", {}).get("total_tokens", 0)
self.error_count = 0
except Exception as e:
self.error_count += 1
print(f"[Worker-{worker_id}] 错误: {e}")
if self.error_count >= self.config.circuit_breaker_threshold:
self.circuit_open = True
self.circuit_open_time = time.time()
print(f"[Worker-{worker_id}] 触发熔断!")
async def _call_api(self, data: dict) -> dict:
"""调用 HolySheep API"""
# 这里简化了,实际使用 aiohttp
# 调用地址:https://api.holysheep.ai/v1/chat/completions
payload = {
"model": "gpt-5-nano",
"messages": [{"role": "user", "content": data["prompt"]}],
"temperature": 0.3
}
# 实际请求逻辑...
return {"result": "OK", "cost": 0.05, "usage": {"total_tokens": 1000}}
async def get_cost_report(self) -> dict:
"""获取费用报告"""
return {
"total_tokens": self.total_tokens,
"total_cost_usd": self.total_cost,
"total_cost_cny": self.total_cost, # ¥1=$1
"avg_cost_per_1m": (self.total_cost / self.total_tokens * 1_000_000) if self.total_tokens else 0
}
async def start_workers(self, num_workers: int = 10):
"""启动多个 Worker"""
tasks = [
asyncio.create_task(self.process_worker(i))
for i in range(num_workers)
]
print(f"已启动 {num_workers} 个 Worker,当前 QPS 限制: {self.config.max_qps}")
await asyncio.gather(*tasks)
使用示例
async def main():
config = BatchConfig(
api_key="YOUR_HOLYSHEEP_API_KEY",
max_qps=500,
batch_size=100
)
processor = EnterpriseBatchProcessor(config)
await processor.connect()
# 启动 Worker
asyncio.create_task(processor.start_workers(num_workers=10))
# 提交测试任务
task_id = await processor.submit_batch([
{"prompt": f"分析这段文本的情感: {i}" * 10}
for i in range(10000)
])
print(f"已提交任务: {task_id}")
# 监控费用
for _ in range(100):
await asyncio.sleep(10)
report = await processor.get_cost_report()
print(f"当前费用: ¥{report['total_cost_cny']:.2f}, Token数: {report['total_tokens']:,}")
asyncio.run(main())
为什么选 HolySheep?5 个不可拒绝的理由
在我深度使用 HolySheep API 的过程中,以下几点是我认为它真正解决国内开发者痛点的核心优势:
1. 无损汇率:节省超过 85% 的充值成本
官方 API 充值按 ¥7.3=$1 计算,而 HolySheep 的 无损汇率 ¥1=$1 意味着:同样的预算,你能多调用 7.3 倍的 Token。按月消耗 100 万 Token 计算,光汇率差每年就能节省 ¥6.3 万元。
2. 国内直连:延迟从 300ms 降到 50ms
实测从上海节点调用官方 API 的延迟约 280-400ms,而 HolySheep 的国内服务器将延迟稳定在 30-50ms。对于批量处理场景,这意味着总耗时减少 85% 以上。
3. 注册即送免费额度:零成本验证
无需绑定信用卡,注册即送 额度可以直接测试 GPT-5-nano 的实际效果。我在正式采购前用赠送额度完成了全部功能验证,节省了至少 $50 的测试成本。
4. 微信/支付宝直充:秒级到账
对比官方需要国际信用卡、其他平台需要等待审核,HolySheep 支持微信、支付宝、企业对公转账,充值秒级到账。这对于需要快速扩量的业务来说是刚性需求。
5. 2026 主流模型全支持:统一入口
| 模型 | 输入价格/MTok | 输出价格/MTok | 适用场景 |
|---|---|---|---|
| GPT-5-nano | $0.05 | $0.05 | 批量处理、高吞吐量 |
| GPT-4.1 | $6 | $8 | 复杂推理、代码生成 |
| Claude Sonnet 4.5 | $10 | $15 | 长文本分析、创意写作 |
| Gemini 2.5 Flash | $1.25 | $2.50 | 快速响应、多模态 |
| DeepSeek V3.2 | $0.28 | $0.42 | 中文场景、性价比 |
常见报错排查
在实际项目中,我整理了开发者最容易遇到的 5 类问题及其解决方案:
错误 1:401 Unauthorized - API Key 无效
# ❌ 错误示例:Key 格式错误或包含空格
api_key = " YOUR_HOLYSHEEP_API_KEY " # 错误:有空格
api_key = "sk-xxxxxx" # 错误:使用了 OpenAI 格式的 Key
✅ 正确示例
api_key = "YOUR_HOLYSHEEP_API_KEY" # 直接使用 HolySheep 提供的 Key
验证 Key 是否有效
import requests
response = requests.get(
"https://api.holysheep.ai/v1/models",
headers={"Authorization": f"Bearer {api_key}"}
)
if response.status_code == 200:
print("API Key 验证通过!")
print("可用模型:", [m["id"] for m in response.json()["data"]])
else:
print(f"认证失败: {response.status_code} - {response.text}")
# 解决方案:检查 Key 是否过期或未激活
错误 2:429 Rate Limit Exceeded - 请求频率超限
# ❌ 错误示例:无限制并发请求
tasks = [process_one(text) for text in texts]
results = await asyncio.gather(*tasks) # 可能触发限流
✅ 正确示例:添加限流和重试机制
import asyncio
from tenacity import retry, stop_after_attempt, wait_exponential
class RateLimitedClient:
def __init__(self, api_key, max_qps=100):
self.api_key = api_key
self.semaphore = asyncio.Semaphore(max_qps)
self.base_delay = 1.0 # 基础延迟(秒)
async def call_with_retry(self, payload):
async with self.semaphore: # 限制并发
for attempt in range(3):
try:
response = await self._make_request(payload)
if response.status_code == 429:
# 遇到限流,等待后重试(指数退避)
wait_time = self.base_delay * (2 ** attempt)
print(f"触发限流,等待 {wait_time}s...")
await asyncio.sleep(wait_time)
continue
return response.json()
except Exception as e:
if attempt == 2:
raise
await asyncio.sleep(1)
async def _make_request(self, payload):
# 实现请求逻辑
pass
使用限流客户端
client = RateLimitedClient("YOUR_HOLYSHEEP_API_KEY", max_qps=50)
async def safe_batch_call(texts):
tasks = [client.call_with_retry({"text": t}) for t in texts]
results = await asyncio.gather(*tasks, return_exceptions=True)
success = [r for r in results if not isinstance(r, Exception)]
failed = [r for r in results if isinstance(r, Exception)]
print(f"成功: {len(success)}, 失败: {len(failed)}")
return success
错误 3:400 Bad Request - 请求体格式错误
# ❌ 错误示例:model 名称错误或参数缺失
payload = {
"model": "gpt-5-nano", # 正确
"messages": [{"role": "user"}], # 错误:缺少 content
"temperature": 1.5 # 错误:超出范围 (0-2)
}
✅ 正确示例:完整且规范的请求体
payload = {
"model": "gpt-5-nano",
"messages": [
{
"role": "system",
"content": "你是一个有帮助的助手。"
},
{
"role": "user",
"content": "请分析这段文本的情感倾向。"
}
],
"temperature": 0.7, # 有效范围 0-2
"max_tokens": 1000, # 最大 4096
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0
}
验证请求体
required_fields = ["model", "messages"]
optional_fields = ["temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty"]
def validate_payload(payload):
errors = []
# 检查必填字段
for field in required_fields:
if field not in payload:
errors.append(f"缺少必填字段: {field}")
# 检查 model 是否有效
valid_models = ["gpt-5-nano", "gpt-4.1", "gpt-4o", "claude-sonnet-4.5"]
if "model" in payload and payload["model"] not in valid_models:
errors.append(f"无效的 model: {payload['model']}")
# 检查 temperature 范围
if "temperature" in payload:
if not 0 <= payload["temperature"] <= 2:
errors.append("temperature 必须在 0-2 之间")
# 检查 messages 格式
if "messages" in payload:
for i, msg in enumerate(payload["messages"]):
if "role" not in msg or "content" not in msg:
errors.append(f"messages[{i}] 缺少 role 或 content")
if msg["role"] not in ["system", "user", "assistant"]:
errors.append(f"messages[{i}] role 无效: {msg['role']}")
if errors:
raise ValueError(f"请求体验证失败:\n" + "\n".join(errors))
return True
validate_payload(payload)
print("请求体验证通过!")
错误 4:500 Internal Server Error - 服务器端错误
# ❌ 遇到 500 就放弃?不,我们需要优雅降级
import asyncio
async def call_with_fallback(texts):
"""
当 HolySheep 不可用时,自动切换到备用方案
实际项目中可以切换到其他模型或本地服务
"""
primary_url = "https://api.holysheep.ai/v1/chat/completions"
for attempt in range(3):
try:
# 尝试主服务器
response = await call_api(primary_url, texts)
return {"source": "holysheep", "data": response}
except ServerError as e:
if attempt < 2:
wait_time = 2 ** attempt
print(f"HolySheep 服务异常 ({e.code}),{wait_time}s 后重试...")
await asyncio.sleep(wait_time)
continue
else:
# 最后一次尝试仍然失败,启用降级方案
print("主服务不可用,启用降级方案...")
return await call_with_local_model(texts)
async def call_api(url, texts):
"""模拟 API 调用"""
# 实际实现中使用 aiohttp
pass
async def call_with_local_model(texts):
"""
降级方案:使用本地小模型或缓存结果
实际项目中可以调用 DeepSeek 或其他备用服务
"""
# 降级到本地处理
return {"source": "local_fallback", "data": texts}
监控脚本:检测服务健康状态
async def health_check():
"""定期检查 HolySheep 服务状态"""
while True:
try:
response = requests.get(
"https://api.holysheep.ai/v1/models",
headers={"Authorization": f"Bearer YOUR_HOLYSHEEP_API_KEY"},
timeout=5
)
if response.status_code == 200:
print(f"✓ HolySheep 服务正常 | 延迟: {response.elapsed.total_seconds()*1000:.0f}ms")
else:
print(f"⚠ HolySheep 服务异常: {response.status_code}")
except Exception as e:
print(f"✗ HolySheep 服务不可达: {e}")
await asyncio.sleep(30)
错误 5:费用超支 - 忘记设置使用上限
# ❌ 没有预算控制?小心账单爆炸
很多团队在使用 API 时忽略了成本监控,导致月末账单远超预期
✅ 正确示例:设置多层级预算控制
from datetime import datetime, timedelta
class BudgetController:
"""预算控制器 - 防止费用超支"""
def __init__(self, monthly_limit_usd=100):
self.monthly_limit = monthly_limit_usd
self.daily_limit = monthly_limit_usd / 30
self.current_month_cost = 0.0
self.daily_costs = {}
def check_budget(self, estimated_tokens: int) -> bool:
"""检查预估费用是否超预算"""
estimated_cost = (estimated_tokens / 1_000_000) * 0.05 # $0.05/MTok
today = datetime.now().strftime("%Y-%m-%d")
# 每日预算检查
today_cost = self.daily_costs.get(today, 0)
if today_cost + estimated_cost > self.daily_limit:
print(f"⚠ 超过每日预算 ({self.daily_limit}),当前: {today_cost}")
return False
# 每月预算检查
if self.current_month_cost + estimated_cost > self.monthly_limit:
print(f"⚠ 超过每月预算 ({self.monthly_limit}),当前: {self.current_month_cost}")
return False
return True
def record_usage(self, tokens_used: int, cost: float):
"""记录实际使用量"""
today = datetime.now().strftime("%Y-%m-%d")
self.daily_costs[today] = self.daily_costs.get(today, 0) + cost
self.current_month_cost += cost
print(f"📊 今日费用: ¥{self.daily_costs[today]:.2f} | "
f"本月费用: ¥{self.current_month_cost:.2f}")
def get_report(self):
"""生成费用报告"""
return {
"monthly_limit": self.monthly_limit,
"current_month_cost": self.current_month_cost,
"remaining": self.monthly_limit - self.current_month_cost,
"usage_rate": f"{(self.current_month_cost / self.monthly_limit * 100):.1f}%"
}
使用示例
controller = BudgetController(monthly_limit_usd=50)
async def process_with_budget_check(texts):
batch_size = 100
total_cost = 0.0
for i in range(0, len(texts), batch_size):
batch = texts[i:i+batch_size]
estimated_tokens = sum(len(t) for t in batch) * 1.3 # 估算放大系数
# 预算检查
if not controller.check_budget(estimated_tokens):
print("⚠ 触发预算限制,暂停处理")
# 可以发送告警通知
await send_alert(controller.get_report())
break
# 执行处理
result = await call_api(batch)
# 记录实际费用
controller.record_usage(result["tokens"], result["cost"])
total_cost += result["cost"]
return {"total_cost": total_cost, "report": controller