hermes - 💡(How to fix) Fix [Bug]: DeepSeek provider ignores api_key in config.yaml, hardcoded only reads environment variable DEEPSEEK_API_KEY [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error code: 401 - {'error': {'message': 'Authentication Fails, Your api key: 0075 is invalid', 'type': 'authentication_error', 'param': None, 'code': 'invalid_request_error'}}

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

Code Example

Error code: 401 - {'error': {'message': 'Authentication Fails, Your api key: 0075 is invalid', 'type': 'authentication_error', 'param': None, 'code': 'invalid_request_error'}}

---
RAW_BUFFERClick to expand / collapse

Bug Description

The DeepSeek provider in Hermes Agent has an implementation defect: It completely ignores the api_key field configured in config.yaml, and is hardcoded to only read the DEEPSEEK_API_KEY environment variable for authentication.

This is inconsistent with the configuration logic of other model providers (OpenAI, Anthropic, etc.), which normally read credentials from config.yaml first.

Steps to Reproduce

  1. Configure DeepSeek node correctly in ~/.hermes/config.yaml, fill in valid api_key;
  2. Do not set the DEEPSEEK_API_KEY environment variable locally;
  3. Start Hermes and try to call DeepSeek model;
  4. Authentication fails, prompt missing API key.

Expected Behavior

Consistent with other providers:

  1. Priority to read api_key from config.yaml;
  2. Fallback to environment variable DEEPSEEK_API_KEY only if the config value is empty.

Actual Behavior

  1. The api_key in config.yaml is never parsed and used;
  2. Only the DEEPSEEK_API_KEY environment variable takes effect;
  3. Users cannot configure credentials uniformly through the configuration file.

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

Error code: 401 - {'error': {'message': 'Authentication Fails, Your api key: 0075 is invalid', 'type': 'authentication_error', 'param': None, 'code': 'invalid_request_error'}}

Operating System

Ubuntu 24.04

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

From the source code logic of deepseek.py, the provider hardcodes obtaining the key only via os.getenv("DEEPSEEK_API_KEY"), without any logic to read the api_key field from the local provider config.

Proposed Fix (optional)

Unify the logic with other providers:

  1. First fetch api_key from config.yaml;
  2. If empty or not configured, then read the DEEPSEEK_API_KEY environment variable as fallback;
  3. Remove hardcoded dependency on environment variable only.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING