ZhuLinsen/daily_stock_analysis · error · ValueError
未配置 Vision API。请设置 LITELLM_MODEL 或相关 API Key。
Error message
未配置 Vision API。请设置 LITELLM_MODEL 或相关 API Key。
What it means
Error "未配置 Vision API。请设置 LITELLM_MODEL 或相关 API Key。" thrown in ZhuLinsen/daily_stock_analysis.
Source
Thrown at src/services/image_stock_extractor.py:276
def _deployment_allows_empty_api_key(deployment: Dict[str, Any]) -> bool:
"""Return whether a configured vision deployment is a supported keyless endpoint."""
params = deployment.get("litellm_params") or {}
if str(params.get("api_key") or "").strip():
return False
wire_model = str(params.get("model") or "").strip()
protocol = wire_model.split("/", 1)[0] if "/" in wire_model else None
return channel_allows_empty_api_key(protocol, params.get("api_base"))
def _call_litellm_vision(image_b64: str, mime_type: str, api_key: Optional[str] = None) -> str:
"""Extract stock codes from an image using litellm (all providers via OpenAI vision format)."""
global litellm
cfg = get_config()
model = _resolve_vision_model()
if not model:
raise ValueError("未配置 Vision API。请设置 LITELLM_MODEL 或相关 API Key。")
if route_has_hermes(getattr(cfg, "llm_model_list", []) or [], model):
raise ValueError("Hermes Vision 未验证:VISION_MODEL 不能选择包含 Hermes deployment 的 route。")
deployments = _matching_vision_deployments(model, cfg)
keys = _get_api_keys_for_model(model, cfg)
key = api_key if api_key and api_key in keys else (random.choice(keys) if keys else None)
deployment_params: Dict[str, Any] = {}
if deployments:
deployment = next(
(
item
for item in deployments
if str((item.get("litellm_params") or {}).get("api_key") or "").strip() == key
),
None,
)
if deployment is None:View on GitHub (pinned to 5159bd72e8)
Solutions
- Set LITELLM_MODEL and the corresponding API key (e.g. OPENAI_API_KEY, GEMINI_API_KEY) in .env to enable the Vision API.
- Choose a vision-capable model and configure its credentials.
- Restart the service after updating the environment configuration.
When it happens
Trigger: Thrown at src/services/image_stock_extractor.py:276 when the library encounters an invalid state.
Common situations: Raised when no vision-capable model is configured for image extraction; occurs when LITELLM_MODEL and related API keys are unset while using image import.
AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15).
Data as JSON: /api/errors/06415521b60d4ac8.
Report an issue: GitHub.