Skip to main content

API Key Issues

Problem: Config contains $OPENAI_API_KEY literally instead of the actual key value.Solution:DeerFlow automatically resolves environment variables in config values that start with $.
  1. Correct syntax in config.yaml:
  2. Verify environment variable is set:
  3. Set environment variable properly: Option A: .env file (recommended for Docker):
    Option B: Shell export:
    Option C: Docker Compose env_file:
  4. Verify variable is loaded in Python:
Problem: 401 Unauthorized or Invalid API key from OpenAI, Anthropic, etc.Solution:
  1. Verify API key is valid: OpenAI:
    Anthropic:
  2. Common API key issues:
    • Expired key: Generate new key from provider dashboard
    • Wrong project: Ensure key has access to the model
    • Rate limited: Check provider dashboard for limits
    • Trailing spaces: Trim whitespace in .env file
  3. Regenerate API key:
  4. Check key format:
    • OpenAI: sk-proj-... (project keys) or sk-... (legacy)
    • Anthropic: sk-ant-...
    • DeepSeek: sk-...
    • Google: Usually starts with AI...
  5. Test with minimal config:
Problem: API key works when tested directly but fails in DeerFlow.Solution:
  1. Check environment isolation:
  2. For Docker deployment:
  3. Verify config resolution:
  4. Check for config typos:

Model Loading Errors

Problem: ModuleNotFoundError: No module named 'langchain_openai' or similar.Solution:DeerFlow uses LangChain provider packages. Each provider must be installed separately.
  1. Install required provider:
  2. Verify installation:
  3. For custom/patched models:
  4. Common provider packages:
Problem: Model 'gpt-5' not found or InvalidRequestError: model not supported.Solution:
  1. Check model ID is correct for provider: OpenAI models:
    Valid OpenAI models (as of 2024):
    • gpt-4-turbo-preview
    • gpt-4
    • gpt-4-32k
    • gpt-3.5-turbo
    Anthropic models:
  2. Verify model is available in your account:
  3. Check for typos:
  4. For OpenAI-compatible APIs (Novita, Ollama, etc.):
  5. Test model ID directly:
Problem: Model doesn’t support features like image understanding or extended thinking.Solution:
  1. Enable vision support:
    Models with vision support:
    • OpenAI: gpt-4-turbo, gpt-4o, gpt-4-vision-preview
    • Anthropic: claude-3-5-sonnet-20241022, claude-3-opus-20240229
    • Google: gemini-2.5-pro, gemini-1.5-pro
  2. Enable thinking/reasoning mode:
  3. Configure per-model extended thinking:
  4. Verify model actually supports the feature:

Provider Configuration Problems

Problem: Custom OpenAI-compatible endpoint fails with authentication or model errors.Solution:
  1. Use ChatOpenAI with base_url:
  2. Test endpoint connectivity:
  3. Common provider configurations: Ollama (local):
    LM Studio (local):
    vLLM server:
  4. Check if endpoint requires /v1 suffix:
Problem: Azure OpenAI deployment fails with endpoint or authentication errors.Solution:
  1. Use AzureChatOpenAI class:
  2. Get values from Azure portal:
    • azure_deployment: Your deployment name (e.g., “gpt-4-deployment”)
    • azure_endpoint: Your resource endpoint
    • api_key: Keys and Endpoint → KEY 1 or KEY 2
    • api_version: Use latest from Azure docs
  3. Test Azure endpoint:
  4. Common Azure mistakes:
Problem: 429 Too Many Requests or Quota exceeded errors.Solution:
  1. Check rate limits in provider dashboard:
  2. Upgrade account tier:
    • Many providers have higher limits for paid tiers
    • OpenAI: Increase from free tier to paid
    • Check if you need to add payment method
  3. Implement retry logic (automatic in LangChain):
  4. Use multiple models as fallback:
  5. Monitor usage:
Problem: Model responses are cut off or empty.Solution:
  1. Increase max_tokens:
  2. Check model’s actual limits:
    • GPT-4: 8192 output tokens max
    • GPT-4 Turbo: 4096 output tokens max
    • Claude 3.5 Sonnet: 8192 output tokens max
    • DeepSeek V3: 8192 output tokens max
  3. Set appropriate temperature:
  4. Test model directly:

Next Steps