Environment:666ghj BettaFish DeepSeek API
| Knowledge Sources | |
|---|---|
| Domains | NLP, LLMs, API_Integration |
| Last Updated | 2026-10-08 21:30 GMT |
Overview
DeepSeek LLM API access for topic extraction and keyword generation in the MindSpider crawling pipeline.
Description
This environment provides access to the DeepSeek LLM API (OpenAI-compatible) for the MindSpider component. DeepSeek powers the TopicExtractor, which uses AI to extract keywords and topics from news data for social media crawling. The API is accessed via the `openai` Python SDK with base URL `https://api.deepseek.com` and model names such as `deepseek-chat` or `deepseek-reasoner`.
Usage
Use this environment when running MindSpider topic extraction tasks. It is required by the TopicExtractor implementation for AI-driven keyword extraction from collected news data.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Any | API calls are remote |
| Hardware | CPU sufficient | No GPU required |
| Network | Outbound HTTPS | Must reach `api.deepseek.com` |
Dependencies
System Packages
- None beyond Python runtime
Python Packages
- `openai` >= 1.3.0
Credentials
The following environment variables must be set in `.env`:
- `MINDSPIDER_API_KEY`: DeepSeek API key for MindSpider
- `MINDSPIDER_BASE_URL`: Base URL (default: `https://api.deepseek.com`)
- `MINDSPIDER_MODEL_NAME`: Model name (recommended: `deepseek-chat` or `deepseek-reasoner`)
Quick Install
pip install openai>=1.3.0
Code Evidence
MindSpider configuration from `MindSpider/config.py:25-27`:
MINDSPIDER_API_KEY: Optional[str] = Field(None, description="MINDSPIDER API密钥")
MINDSPIDER_BASE_URL: Optional[str] = Field("https://api.deepseek.com", description="推荐deepseek-chat模型使用")
MINDSPIDER_MODEL_NAME: Optional[str] = Field("deepseek-chat", description="推荐deepseek-chat")
Config validation from `MindSpider/main.py:54-69`:
required_configs = [
'DB_HOST', 'DB_PORT', 'DB_USER', 'DB_PASSWORD', 'DB_NAME', 'DB_CHARSET',
'MINDSPIDER_API_KEY', 'MINDSPIDER_BASE_URL', 'MINDSPIDER_MODEL_NAME'
]
for config_name in required_configs:
if not hasattr(settings, config_name) or not getattr(settings, config_name):
missing_configs.append(config_name)
if missing_configs:
logger.error(f"配置缺失: {', '.join(missing_configs)}")
return False
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `配置缺失: MINDSPIDER_API_KEY` | API key not set in `.env` | Apply at https://platform.deepseek.com/ and set `MINDSPIDER_API_KEY` |
| `openai.AuthenticationError` | Invalid API key | Verify key in DeepSeek dashboard |
| `ConnectionError` | Cannot reach `api.deepseek.com` | Check network/firewall settings |
Compatibility Notes
- DeepSeek models: `deepseek-chat` (standard) and `deepseek-reasoner` (reasoning-enhanced) are both supported.
- OpenAI-compatible: DeepSeek API uses OpenAI SDK; any OpenAI-compatible client works.
- MindSpider isolation: MindSpider has its own `config.py` separate from the global `config.py`, both reading from the same `.env` file.