Building a Proxy to Enhance AI Coding Tool Capabilities
The author built a proxy to bridge the gaps between the OpenCode AI coding tool and the Straico API, which lacked streaming responses and function calling support.
Why it matters
This proxy solution enables the author to continue using the OpenCode AI coding tool with the Straico API, overcoming key limitations and providing a more seamless experience.
Key Points
- 1The author switched from Claude Code to OpenCode due to session limits on the former
- 2Straico's API is missing two key features needed by OpenCode: streaming responses and function calling
- 3The author built a proxy to translate requests and responses, simulating streaming and injecting tool definitions
- 4The proxy uses a provider pattern to support multiple AI providers, with Straico as the initial implementation
Details
The author uses OpenCode as their main AI coding tool, but found that Straico's API, which provides access to models like Claude, GPT, and Gemini, was missing two critical features: streaming responses and function calling. Without these, OpenCode would hang and not receive a response, while Straico continued to consume tokens. To address this, the author built a proxy that sits between OpenCode and Straico, translating requests and responses to fill in the gaps. The proxy uses a provider pattern, with Straico-specific logic in the StraicoProvider class, and stubs for adding support for other providers like OpenAI and Anthropic in the future. The proxy also includes features like simulating streaming responses, tool injection, conversation summarization, and syncing the model list to the OpenCode configuration.
No comments yet
Be the first to comment