opencommit icon indicating copy to clipboard operation
opencommit copied to clipboard

[Feature]: Replace manual engine adapters with ai-sdk-core

Open kykungz opened this issue 3 months ago • 1 comments
trafficstars

Description

I’ve noticed that the engine implementations for different AI providers (like OpenAI, Anthropic, etc.) are being maintained manually in this repo.

This makes it cumbersome to support each third-party API individually. For example:

  • Handling the API response from OpenAI manually: https://github.com/di-sukharev/opencommit/blob/c1756b85aff7804b194d41cc9e5bde32c73fe22f/src/engine/openAi.ts#L58-L62
  • Dealing with Anthropic’s error response shapes: https://github.com/di-sukharev/opencommit/blob/c1756b85aff7804b194d41cc9e5bde32c73fe22f/src/engine/anthropic.ts#L64-L74

This approach will make it harder to keep up with rapidly evolving APIs and newer models being released. The boilerplate can become difficult to maintain at scale.

Suggested Solution

Instead of manually handling each engine and response type, I’d recommend offloading this work to a well-maintained abstraction layer.

AI SDK Core by Vercel is an excellent candidate. It provides:

  • A unified interface for calling different LLM providers
  • Built-in support for OpenAI, Anthropic, Mistral, Cohere, Fireworks, Groq, etc.
  • Stream handling, errors, and provider-specific quirks abstracted away
  • Plug-and-play architecture for future provider support

By integrating ai-sdk-core, opencommit could reduce technical debt and improve forward compatibility while maintaining flexibility.

Let me know your thoughts — happy to help if needed!

Alternatives

No response

Additional Context

No response

kykungz avatar Jul 23 '25 17:07 kykungz