Extending the Vercel AI SDK to Microsoft Foundry (TypeScript)
Summary
The Vercel AI SDK gives developers one elegant, provider‑agnostic surface for building agentic applications, but its official AI-sdk/azure provider only targets the Azure OpenAI chat API. This limitation means other models in Microsoft Foundry's catalog, such as Llama, DeepSeek, Mistral, Phi, and Anthropic Claude, are not supported out of the box. To address this, an extension introduces two TypeScript provider adapters. One adapter supports Foundry's OpenAI-compatible `/openai/v1` route for models like OpenAI, DeepSeek, Mistral, and Phi. The second adapter targets Foundry's `/anthropic/v1` route, which speaks the native Anthropic Messages API for Claude models. Both adapters share authentication options, including Entra ID by default and API key as a fallback, and use deployment names as model IDs, ensuring existing application-level code remains unchanged.
Key takeaway
For AI Engineers integrating diverse LLMs with the Vercel AI SDK on Azure, you can now seamlessly access Microsoft Foundry's full catalog, including Llama, DeepSeek, Mistral, Phi, and Anthropic Claude. This extension eliminates the limitation of the official Azure OpenAI provider, allowing you to maintain model portability and avoid changes to your agent orchestration logic. Implement the custom TypeScript provider adapters to expand your model choices and enhance application flexibility.
Key insights
The Vercel AI SDK can be extended to access Microsoft Foundry's diverse LLM catalog beyond Azure OpenAI via custom provider adapters.
Principles
- Maintain model-agnostic orchestration logic.
- Foundry offers a single multi-model backplane.
- Use specific API routes for different model families.
Method
Implement two TypeScript provider adapters: one for Foundry's OpenAI-compatible `/openai/v1` route and another for the `/anthropic/v1` route, handling distinct wire protocols and authentication.
In practice
- Use `createFoundry` for OpenAI-compatible models.
- Use `createAnthropicFoundry` for Claude models.
- Configure Entra ID or API key for authentication.
Topics
- Vercel AI SDK
- Microsoft Foundry
- Large Language Models
- Azure OpenAI
- Anthropic Claude
- TypeScript Development
- API Integration
Best for: AI Engineer, Software Engineer, MLOps Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Microsoft Foundry Blog articles.