binary-husky/gpt_academic · error · RuntimeError
请配置 TAICHU_API_KEY
Error message
请配置 TAICHU_API_KEY
What it means
Configuration guard of the Taichu (太极/taichu) LLM bridge: predict_no_ui_long_connection raises RuntimeError('请配置 TAICHU_API_KEY') when validate_key() finds the TAICHU_API_KEY config value empty. It fires before TaichuChatInit is imported, so no network traffic has occurred.
Source
Thrown at request_llms/bridge_taichu.py:28
def validate_key():
TAICHU_API_KEY = get_conf("TAICHU_API_KEY")
if TAICHU_API_KEY == '': return False
return True
def predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[], sys_prompt:str="",
observe_window:list=[], console_silence:bool=False):
"""
⭐多线程方法
函数的说明请见 request_llms/bridge_all.py
"""
watch_dog_patience = 5
response = ""
# if llm_kwargs["llm_model"] == "taichu":
# llm_kwargs["llm_model"] = "taichu"
if validate_key() is False:
raise RuntimeError('请配置 TAICHU_API_KEY')
# 开始接收回复
from .com_taichu import TaichuChatInit
zhipu_bro_init = TaichuChatInit()
for chunk, response in zhipu_bro_init.generate_chat(inputs, llm_kwargs, history, sys_prompt):
if len(observe_window) >= 1:
observe_window[0] = response
if len(observe_window) >= 2:
if (time.time() - observe_window[1]) > watch_dog_patience:
raise RuntimeError("程序终止。")
return response
def predict(inputs:str, llm_kwargs:dict, plugin_kwargs:dict, chatbot:ChatBotWithCookies,
history:list=[], system_prompt:str='', stream:bool=True, additional_fn:str=None):
"""
⭐单线程方法
函数的说明请见 request_llms/bridge_all.pyView on GitHub (pinned to d6bde0fa54)
Solutions
- Obtain an API key from the Taichu open platform and set TAICHU_API_KEY in config_private.py (or env / docker-compose), then restart
- Confirm the loaded value: from toolbox import get_conf; assert get_conf('TAICHU_API_KEY') != ''
- If using docker, add TAICHU_API_KEY to the container environment
Example fix
# before TAICHU_API_KEY = '' # after (config_private.py) TAICHU_API_KEY = 'your-taichu-key'
Defensive patterns
Strategy: validation
Validate before calling
from toolbox import get_conf
assert get_conf('TAICHU_API_KEY'), 'TAICHU_API_KEY not configured' Try / catch
try:
predict_no_ui_long_connection(...)
except RuntimeError as e:
if 'TAICHU_API_KEY' in str(e):
raise ConfigurationError(str(e)) from e
raise Prevention
- Configure only the providers you actually use; keep a checklist per model
- Validate keys in a preflight hook before dispatching to a bridge
When it happens
Trigger: Calling request_llms/bridge_taichu.py:28 predict_no_ui_long_connection() (used by background/plugin threads) with TAICHU_API_KEY == '' as resolved by get_conf from config.py, config_private.py or the environment.
Common situations: Default config.py ships with an empty TAICHU_API_KEY; user selected the taichu model without registering on the Taichu open platform; key placed in config.py but a config_private.py or env var overrides it with an empty string.
Related errors
- 请配置讯飞星火大模型的XFYUN_APPID, XFYUN_API_KEY, XFYUN_API_SECRET
- 请配置ZHIPUAI_API_KEY
- 请配置 DASHSCOPE_API_KEY
- 请配置讯飞星火大模型的XFYUN_APPID, XFYUN_API_KEY, XFYUN_API_SECRET
- 文件大小 ({file_size_mb:.1f}MB) 超过限制 {max_size_mb}MB
AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14).
Data as JSON: /api/errors/b44d6e59461b6e37.
Report an issue: GitHub.