Building a Multi-Provider AI Agent in TypeScript — No SDKs, Just Fetch
This article describes the creation of a lightweight TypeScript library, "ai-agent-starter", for interacting with OpenAI, Anthropic, and Ollama through a unified API. The library avoids heavy SDK dependencies by using only the native "fetch" API for flexibility and portability across AI providers. It aims to solve provider lock-in and heavy dependency issues found in existing AI SDKs. This tool offers a single interface for developing AI agents that work with various platforms without complex rewrites, focusing on native and efficient tool integration. This approach ensures that developers can build robust and scalable solutions that are easy to maintain and adapt to future needs, promoting innovation and efficiency in AI development. The "ai-agent-starter" also improves how language models interact with tools, replacing regex parsing with native capabilities, making interactions more reliable.
Read original ↗