binary-husky/gpt_academic · error · ValueError
Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:{endpoint}
Error message
Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:{endpoint} What it means
ValueError from verify_endpoint in bridge_openrouter, an lru_cache'd guard that rejects any AZURE_ENDPOINT still containing the literal placeholder text '你亲手写的api名称' ('the api name you wrote by hand') copied from the config template. It exists to fail fast before an HTTP request is made with an obviously unedited endpoint.
Source
Thrown at request_llms/bridge_openrouter.py:119
try:
chunkjson = json.loads(chunk_decoded[6:])
has_choices = 'choices' in chunkjson
if has_choices: choice_valid = (len(chunkjson['choices']) > 0)
if has_choices and choice_valid: has_content = ("content" in chunkjson['choices'][0]["delta"])
if has_content: has_content = (chunkjson['choices'][0]["delta"]["content"] is not None)
if has_choices and choice_valid: has_role = "role" in chunkjson['choices'][0]["delta"]
except:
pass
return chunk_decoded, chunkjson, has_choices, choice_valid, has_content, has_role
from functools import lru_cache
@lru_cache(maxsize=32)
def verify_endpoint(endpoint):
"""
检查endpoint是否可用
"""
if "你亲手写的api名称" in endpoint:
raise ValueError("Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:" + endpoint)
return endpoint
def predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[], sys_prompt:str="", observe_window:list=None, console_silence:bool=False):
"""
发送至chatGPT,等待回复,一次性完成,不显示中间过程。但内部用stream的方法避免中途网线被掐。
inputs:
是本次问询的输入
sys_prompt:
系统静默prompt
llm_kwargs:
chatGPT的内部调优参数
history:
是之前的对话列表
observe_window = None:
用于负责跨越线程传递已经输出的部分,大部分时候仅仅为了fancy的视觉效果,留空即可。observe_window[0]:观测窗。observe_window[1]:看门狗
"""
from request_llms.bridge_all import model_info
View on GitHub (pinned to d6bde0fa54)
Solutions
- Set AZURE_ENDPOINT in config_private.py to your real Azure OpenAI endpoint URL (https://<resource>.openai.azure.com)
- Restart the process after editing config so the lru_cache on verify_endpoint is cleared
- Grep the config for leftover placeholder text (你亲手写的api名称) and replace every occurrence
Example fix
# before AZURE_ENDPOINT = "https://你亲手写的api名称.openai.azure.com" # after AZURE_ENDPOINT = "https://my-real-resource.openai.azure.com"
Defensive patterns
Strategy: validation
Validate before calling
from config import AZURE_ENDPOINT
assert AZURE_ENDPOINT and '你亲手写的api名称' not in AZURE_ENDPOINT, \
'AZURE_ENDPOINT still contains the template placeholder'
assert AZURE_ENDPOINT.startswith('https://') and '.openai.azure.com' in AZURE_ENDPOINT Try / catch
try:
verify_endpoint(endpoint)
except ValueError as e:
print(f'Fix config before running: {e}')
sys.exit(2) Prevention
- Add a startup config lint that rejects known template placeholders across all config keys
- Restart the process after config edits - verify_endpoint is lru_cached
- Use config_private.py so template text in config.py never leaks into runtime
When it happens
Trigger: AZURE_ENDPOINT in config.py (or environment) left as the template placeholder; deploying with the stock config_private.py.example values; cached stale config after editing but before process restart (lru_cache also caches the pass result).
Common situations: Fresh clone where the user copied config.py defaults without filling in their Azure deployment name; CI using template config; renaming the Azure deployment but not the config.
Related errors
- Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
- Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
- 用户代理或助理代理未定义
- AZURE_CFG_ARRAY中配置的模型必须以azure开头
- 模型覆盖参数 '{model_override}' 指向一个暂不支持的模型,请检查配置文件。
AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14).
Data as JSON: /api/errors/f3ccc6d6c95a84c7.
Report an issue: GitHub.