Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Anthropic API key check runs regardless of selected LLM provider #115

Closed
bhouston opened this issue Mar 6, 2025 · 0 comments · Fixed by #116
Closed

Bug: Anthropic API key check runs regardless of selected LLM provider #115

bhouston opened this issue Mar 6, 2025 · 0 comments · Fixed by #116
Labels
bug Something isn't working

Comments

@bhouston
Copy link
Member

bhouston commented Mar 6, 2025

Bug: Anthropic API key check runs regardless of selected LLM provider

Description

Users are encountering an error about the Anthropic API key not being set, even when they've selected a different LLM provider (like OpenAI, Ollama, etc.). This happens because there's a hardcoded check for the Anthropic API key in the tool agent implementation that runs regardless of which provider is configured.

Current Behavior

  • Even when a non-Anthropic provider is selected, the CLI throws an error if the Anthropic API key is not set
  • The error occurs because of a hardcoded check in packages/agent/src/core/toolAgent/toolAgentCore.ts (lines 33-34):
    const apiKey = process.env.ANTHROPIC_API_KEY;
    if (!apiKey) throw new Error(getAnthropicApiKeyError());

Expected Behavior

  • The CLI should only check for the API key of the currently selected LLM provider
  • If the required API key is missing, it should display a helpful error message with a link to provider-specific documentation
  • For example: "OpenAI API key not found. Please see https://mycoder.ai/docs/getting-started/openai for setup instructions."

Proposed Solution

  1. Remove the hardcoded Anthropic API key check from toolAgentCore.ts
  2. Ensure API key checks are provider-specific and only run for the selected provider
  3. Improve error messages to include links to provider-specific documentation pages:
    • mycoder.ai/docs/getting-started/anthropic
    • mycoder.ai/docs/getting-started/openai
    • mycoder.ai/docs/getting-started/ollama
    • etc.

Additional Notes

  • The provider-specific documentation pages don't exist yet, but should be created as part of this fix
  • The CLI command handler in packages/cli/src/commands/$default.ts already has provider-specific API key checks, but the redundant check in the tool agent is causing this issue
@bhouston bhouston added the bug Something isn't working label Mar 6, 2025
bhouston added a commit that referenced this issue Mar 6, 2025
…key-check

Fix #115: Remove hardcoded Anthropic API key check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant