binary-husky/gpt_academic · error · ValueError
Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
Error message
Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
What it means
verify_endpoint is an lru_cache-decorated guard in the ChatGPT bridge that rejects Azure OpenAI endpoints still containing the literal placeholder text '你亲手写的api名称' ('the api name you wrote by hand') from config.py's AZURE_ENDPOINT template. It throws ValueError to force the user to finish editing their Azure configuration before any HTTP request is made. The error exists because Azure deployments require a fully specified deployment URL and unfilled placeholders are a very common copy-paste mistake.
Source
Thrown at request_llms/bridge_chatgpt.py:125
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
- Open config_private.py and set AZURE_ENDPOINT (and the model's entry in AZURE_CFG_ARRAY) to your real deployment URL, e.g. https://your-resource.openai.azure.com/openai/deployments/your-deployment/chat/completions?api-version=2023-05-15.
- Make sure the deployment name in the URL matches the deployment you created in the Azure portal.
- Verify no AZURE_CFG_ARRAY key still holds the placeholder string '你亲手写的api名称'.
- Restart gpt_academic after saving config_private.py so the lru_cache on verify_endpoint is cleared.
Example fix
# before AZURE_ENDPOINT = "https://你亲手写的api名称.openai.azure.com/openai/deployments/你亲手写的api名称/chat/completions?api-version=2023-05-15" # after AZURE_ENDPOINT = "https://my-resource.openai.azure.com/openai/deployments/gpt35/chat/completions?api-version=2023-05-15"
Defensive patterns
Strategy: validation
Validate before calling
from request_llms.bridge_chatgpt import verify_endpoint endpoint = AZURE_CFG_ARRAY[model]["AZURE_ENDPOINT"] assert "你亲手写的api名称" not in endpoint, "fill in the real Azure deployment URL first"
Try / catch
try:
verify_endpoint(endpoint)
except ValueError as e:
print(f"config incomplete: {e}"); exit(1) Prevention
- Never ship config_private.py containing template placeholders — grep for 你亲手写的api名称 before startup.
- Add a startup config lint that walks AZURE_CFG_ARRAY and fails fast with the offending key name.
- Document the exact Azure URL shape (resource/deployment/api-version) next to the config entry.
- Restart the app after config edits so lru_cache caches don't hide fixes.
When it happens
Trigger: Selecting an 'azure-*' model in gpt_academic while AZURE_ENDPOINT (or the AZURE_CFG_ARRAY entry for that model in config_private.py) still contains the placeholder string '你亲手写的api名称' that ships in the default config.py; verify_endpoint(endpoint) is then called before the request and raises.
Common situations: User copies config.py to config_private.py, fills in AZURE_API_KEY but forgets to replace the endpoint template; switching from OpenAI official API to an Azure deployment without reading the Azure config section; config upgraded and the old placeholder survived.
Related errors
- Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:
- AZURE_CFG_ARRAY中配置的模型必须以azure开头
- Endpoint不正确, 请检查AZURE_ENDPOINT的配置! 当前的Endpoint为:{endpoint}
- OpenAI拒绝了请求:
- OpenAI拒绝了请求:
AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14).
Data as JSON: /api/errors/9dc91df1c8a8f586.
Report an issue: GitHub.