Want to work on this? Comment .take and it is yours (first comment wins). When your fix is ready, open a PR with Closes #168.
Good first issue. One guard line, to match four other providers.
What's going on
When you check a provider's health with no API key set, most cloud providers short-circuit and return False right away without hitting the network. Deepgram does not. With no key, DeepgramProvider.health_check still fires a live request to https://api.deepgram.com/v1/projects with the header Authorization: Token None. It does not crash (the whole body is wrapped in try/except Exception: return False), but the request is pointless: no key means it can never pass, so we should skip the round-trip.
Cartesia, Anthropic, ElevenLabs, and AssemblyAI already do the right thing. This issue makes Deepgram match them.
What to do
One file: src/voicegateway/inference/providers/deepgram_provider.py (the health_check method starts at line 44).
Copy the pattern from src/voicegateway/inference/providers/cartesia_provider.py (lines 45-46). Add an early return before the try:
async def health_check(self) -> bool:
import httpx
if not self.api_key:
return False
try:
async with httpx.AsyncClient() as client:
...
That is the entire change. self.api_key is already set in __init__ (line 13), so no other edits are needed.
How to test
There is already a test for this exact pattern on Cartesia. Copy it for Deepgram.
- Look at
src/voicegateway/tests/providers/test_cartesia_health_check.py, specifically test_health_check_returns_false_when_key_missing (lines 48-55). It patches httpx.AsyncClient to blow up if called, then asserts health_check() returns False without ever touching the network.
- Add the same test for
DeepgramProvider (a new file src/voicegateway/tests/providers/test_deepgram_health_check.py, or add a case next to the existing Deepgram tests). Remember to monkeypatch.delenv("DEEPGRAM_API_KEY", raising=False) so an env var does not leak in.
- Run it:
pytest src/voicegateway/tests/providers/test_deepgram_health_check.py
Bonus (optional)
openai_provider.py (line 58) and groq_provider.py (line 48) also probe without this guard. If you want, add the same if not self.api_key: return False line to each in the same PR so all cloud providers behave consistently.
Good first issue. One guard line, to match four other providers.
What's going on
When you check a provider's health with no API key set, most cloud providers short-circuit and return
Falseright away without hitting the network. Deepgram does not. With no key,DeepgramProvider.health_checkstill fires a live request tohttps://api.deepgram.com/v1/projectswith the headerAuthorization: Token None. It does not crash (the whole body is wrapped intry/except Exception: return False), but the request is pointless: no key means it can never pass, so we should skip the round-trip.Cartesia, Anthropic, ElevenLabs, and AssemblyAI already do the right thing. This issue makes Deepgram match them.
What to do
One file:
src/voicegateway/inference/providers/deepgram_provider.py(thehealth_checkmethod starts at line 44).Copy the pattern from
src/voicegateway/inference/providers/cartesia_provider.py(lines 45-46). Add an early return before thetry:That is the entire change.
self.api_keyis already set in__init__(line 13), so no other edits are needed.How to test
There is already a test for this exact pattern on Cartesia. Copy it for Deepgram.
src/voicegateway/tests/providers/test_cartesia_health_check.py, specificallytest_health_check_returns_false_when_key_missing(lines 48-55). It patcheshttpx.AsyncClientto blow up if called, then assertshealth_check()returnsFalsewithout ever touching the network.DeepgramProvider(a new filesrc/voicegateway/tests/providers/test_deepgram_health_check.py, or add a case next to the existing Deepgram tests). Remember tomonkeypatch.delenv("DEEPGRAM_API_KEY", raising=False)so an env var does not leak in.Bonus (optional)
openai_provider.py(line 58) andgroq_provider.py(line 48) also probe without this guard. If you want, add the sameif not self.api_key: return Falseline to each in the same PR so all cloud providers behave consistently.