错误信息: 堆栈信息: AI_APICallError at /Applications/Cherry Studio.app/Contents/Resource...
错误信息
错误名称: AI_APICallError
错误信息:
堆栈信息: AI_APICallError
at /Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:52165:12
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async postToApi$2 (/Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:52080:25)
at async GoogleGenerativeAILanguageModel.doStream (/Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:158145:68)
at async wrapStream (/Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:268739:19)
at async fn (/Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:61695:18)
at async /Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:56251:19
at async _retryWithExponentialBackoff (/Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:56435:10)
at async streamStep (/Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:61664:110)
at async fn (/Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:61981:6)
at async /Applications/Cherry Studio.app/Contents/Resources/app.asar/out/main/main.js:56251:19
状态码: 401
请求路径: https://aihubmix.com/gemini/v1beta/models/gemini-3.1-pro-preview:streamGenerateContent?alt=sse
请求体: {"generationConfig":{},"contents":[{"role":"user","parts":[{"text":"镜头 1|水景与主楼入口\n画面:入口景观喷泉与“金成府”标志\n旁白:住金成府,回家就是舒服。\n镜头 2|小区整体航拍\n画面:小区整体及楼栋分布大景\n旁白:208号楼在园区正中间。\n镜头 3|楼栋位置与周边环境\n画面:208#楼栋特写,展示前不临路、无切角的位置\n旁白:背靠山不临路,静谧聚财。\n镜头 4|跑道与绿化细节\n画面:蓝色跑道与绿植近景\n旁白:楼下就是跑道,散步舒心。\n镜头 5|大楼间距与采光\n画面:楼间距推镜及阳光洒落画面\n旁白:超大楼间距,全天有阳光。\n镜头 6|园林核心景观\n画面:园区中央休闲空间与绿化景观\n旁白:4800平绿化,享楼王同景。\n镜头 7|东西两侧视野\n画面:从高处向东西两侧远眺的景观视野\n旁白:东西视野好,通风真顺畅。\n镜头 8|园区通道与出入口\n画面:通往西门、北门的便捷路径\n旁白:紧邻西北门,出行超方便。\n镜头 9|独立电梯厅与入户\n画面:独立电梯厅及入户门空间展示\n旁白:独立电梯厅,私密又安静。\n镜头 10|室内空间与格局\n画面:通透奢阔的室内客厅及开阔样板间展示\n旁白:120平享受150平大空间。\n镜头 11|高层建筑仰拍收尾\n画面:仰拍208#楼栋挺拔全貌及天空\n旁白:限量36户,绝版手慢无!\n\n根据画面优化一下每句旁白文案 每句字数不能超过12个字"}]}],"systemInstruction":{"parts":[{"text":"你是一位资深的房地产文案与营销策划专家。你的专属任务是为【唐山金隅金成府】项目撰写各类宣传文案、社交媒体推文和活动策划案。\n\n文案需富有创意和感染力;策划案需逻辑清晰、具备实操性。\n请根据我的具体指令灵活调整风格,直接输出高质量内容,无需过多解释。\n输出的文案要求符合广告法,禁止使用极限词\n"}]},"safetySettings":[{"category":"HARM_CATEGORY_HATE_SPEECH","threshold":"BLOCK_NONE"},{"category":"HARM_CATEGORY_DANGEROUS_CONTENT","threshold":"BLOCK_NONE"},{"category":"HARM_CATEGORY_HARASSMENT","threshold":"BLOCK_NONE"},{"category":"HARM_CATEGORY_SEXUALLY_EXPLICIT","threshold":"BLOCK_NONE"},{"category":"HARM_CATEGORY_CIVIC_INTEGRITY","threshold":"BLOCK_NONE"}],"tools":[{"functionDeclarations":[{"name":"fs_read","description":"Read a text file by absolute path.\n\nPrimary use: retrieving the full content behind a <persisted-output> marker — call with the path shown after \"Full output saved to:\". Markers from earlier turns work too (persisted outputs live as long as their message does). Only paths from this conversation's markers are readable; reads elsewhere return access-denied.\n\nPagination is line-based: pass `offset` (1-indexed line) + `limit` for large files; results include `totalLines`. Lines are returned in full (never truncated mid-line); the per-call output is bounded as a whole, and oversized pages return an `output-too-large` error with a file-specific recommended `limit`. The one input it can't subdivide is a single physical line larger than that cap (e.g. heavily minified JSON) — line paging can't split one line and there is no byte-range read, so that case is reported as `output-too-large`; reason from the inline head/tail excerpt for such inputs.\n\nWhen reading a persisted output to summarize, analyze, or act on it, read sequential pages (advance `offset` to the returned `endLine` + 1) until you have covered 100% of the content. Before summarizing or drawing conclusions, state what fraction you actually read — and if you did not read all of it (including the single-oversized-line case), say so explicitly rather than implying full coverage.\n\nThe persistence layer applies to non-read tools only; this tool never persists its own output — narrow the read (smaller `limit`) instead.","parameters":{"required":["path"],"type":"object","properties":{"path":{"description":"Absolute file path. Relative paths are rejected.","type":"string","minLength":1},"offset":{"description":"1-indexed line number to start reading at. Default: 1.","type":"integer"},"limit":{"description":"Maximum number of lines to return. Default: 2000. No schema upper bound — the per-call output cap (the configured tool-output threshold, 50000 chars by default) is the real gate; an oversized page reports the exact cap and a recommended limit.","type":"integer"}}}}]}],"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}}}
响应首部: {
"alt-svc": "h3=\":443\"; ma=2592000",
"content-length": "159",
"content-type": "application/json; charset=utf-8",
"date": "Thu, 06 Aug 2026 08:28:35 GMT",
"document-policy": "include-js-call-stacks-in-crash-reports",
"via": "1.1 google",
"x-aihubmix-request-id": "2026080608283532031448686770818"
}
响应内容: {"error":{"message":"Failed to retrieve token - invalid or expired API key (tid: 2026080608283532031448686770818)","type":"Aihubmix_api_error"},"type":"error"}
AI 解决方案
🔍 报错分析
1. 🌐 错误翻译
原文:Failed to retrieve token - invalid or expired API key (tid: 2026080608283532031448686770818)
译文:获取Token失败 - API密钥无效或已过期(事务ID:2026080608283532031448686770818)
2. 🎯 原因分析
postToApi$2函数中发起API调用时,在GoogleGenerativeAILanguageModel.doStream流程中触发3. 💡 解决方案
// 在应用的API配置模块中,更新有效的API密钥
// 例如(根据实际配置位置修改):
const API_CONFIG = {
// 确保以下配置项使用有效的密钥
apiKey: '你的有效_AIHUBMIX_API_KEY_HERE',
baseUrl: 'https://aihubmix.com/gemini/v1beta'
};
具体操作:
4. 🛡️ 预防措施
dotenv等工具进行配置管理