aisuite
Simple, unified interface to multiple Generative AI providers
aisuite is a lightweight Python library that wraps OpenAI, Anthropic, Google, Mistral, and a dozen other AI providers behind one consistent interface so you can switch models without rewriting code.
aisuite is a small Python library that lets you write code once and use it with many different AI model providers, such as OpenAI, Anthropic, Google, Mistral, Cohere, Hugging Face, and others. Each of those providers has its own SDK, its own way of setting up API keys, and its own parameter names. aisuite wraps all of them behind one consistent interface so you do not have to rewrite your code when switching between models.
The interface is designed to feel like OpenAI's API, which many developers already know. To pick a model you write the provider name, a colon, and the model name, for example openai:gpt-4o or anthropic:claude-3-5-sonnet. You store API keys as environment variables or pass them to the client directly. From there you send a list of messages and get back a response in a standardized format, regardless of which provider is underneath.
The library also handles tool calling, which is where an AI model can request that your program run a function and then continue the conversation with the result. You can pass real Python functions rather than writing out a JSON description of each one, and aisuite generates the necessary schema automatically. Setting a max_turns parameter lets the library manage the back-and-forth loop between the model and your tools without you having to write that loop yourself. It also supports connecting to tools that follow the MCP standard without extra boilerplate.
The README describes it as lightweight rather than a full agent framework, though it does include simple building blocks for standalone agents. You can install just the base library, add only the providers you need, or install everything at once. Adding support for a new provider means writing one file, which makes the project easy to extend.
The examples folder contains Jupyter notebooks for trying out the interface. The project was created by Andrew Ng, a well-known figure in AI education.
Where it fits
- Write one AI chat function and swap between GPT-4o, Claude, and Gemini by changing a single model string.
- Add tool calling to an AI app where models run your Python functions and continue the conversation with the results.
- Connect an AI agent to MCP-compatible tools without writing protocol boilerplate.
- Test the same prompt across multiple AI providers side by side to compare output quality.