Skip to content

feat: implement multi-provider architecture and OpenAI support (#2)#6

Open
ArturCharylo wants to merge 8 commits intoIAmTomShaw:mainfrom
ArturCharylo:feat/multi-provider-support
Open

feat: implement multi-provider architecture and OpenAI support (#2)#6
ArturCharylo wants to merge 8 commits intoIAmTomShaw:mainfrom
ArturCharylo:feat/multi-provider-support

Conversation

@ArturCharylo
Copy link

Closes #2

Description

As discussed in the issue, this PR introduces a multi-provider architecture to make the CLI accessible to users without a GitHub Copilot subscription.

I have refactored the core logic to use an AIProvider interface and implemented OpenAI as the first alternative provider.

Changes made

  • Architecture: Added AIProvider interface and moved the existing Copilot logic into a dedicated CopilotProvider.
  • OpenAI Support: Added OpenAIProvider utilizing the latest gpt-5.2-chat-latest model.
  • Tools Refactoring: Abstracted the Notion and Currency API calls in tools.ts so they can be consumed by both Copilot's SDK and OpenAI's native tool-calling format.
  • CLI Updates: Updated /settings to allow users to select their preferred provider (copilot or openai) and input their API keys.

Next Steps

Since the architectural foundation is now in place, adding support for Anthropic (Claude) or local models like Ollama will be extremely straightforward. I plan to open separate, smaller PRs for those providers once this architectural change is reviewed and merged.

@ArturCharylo
Copy link
Author

🚀 Final Update: Multi-Provider Support & Improved UX

I've completed the implementation of the Anthropic Claude provider and significantly improved the CLI's stability and error handling. The architecture is now fully modular and ready for review.

🛠 Changes since the last update:

  • Anthropic Support: Added AnthropicProvider featuring the latest Claude 4.6 model (claude-4.6-20240924). It includes full support for native tool-calling and recursive message processing for complex quote calculations.
  • Graceful Initialization: Refactored runCli to handle missing API keys gracefully. The CLI no longer exits on initialization errors; instead, it shows a warning and allows the user to use /settings to fix their configuration.
  • Clean Error Reporting: Improved createQuoteFlow to display user-friendly error messages without technical stack traces (available only in DEBUG_MODE).
  • Settings Update: Added ANTHROPIC_API_KEY to the configuration flow and ensured all sensitive keys are masked in the console output.

🧪 Testing

I have verified the functionality locally for all three providers:

  1. GitHub Copilot: Fully tested and works as expected with the existing SDK.
  2. OpenAI & Anthropic: The implementation follows the official documentation for tool-calling and streaming. The logic has been verified for correct message flow and error handling.

Note: As I don't have active subscriptions for OpenAI/Anthropic APIs, I’ve ensured the code is architecturally sound and matches the providers' requirements. I would appreciate it if you could perform a final "live" verification with your keys!

Ready for your feedback @IAmTomShaw!

@ArturCharylo ArturCharylo marked this pull request as ready for review February 25, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The AI Agent needs to be provider agnostic

1 participant