AI/ML API
Learn how to use the AI/ML API provider.
The AI/ML API provider gives access to more than 300 AI models over an OpenAI-compatible API.
Setup
The AI/ML API provider is available via the @ai-ml.api/aimlapi-vercel-ai module. You can install it with:
$ pnpm add @ai-ml.api/aimlapi-vercel-ai
$ npm install @ai-ml.api/aimlapi-vercel-ai
$ yarn add @ai-ml.api/aimlapi-vercel-ai
$ bun add @ai-ml.api/aimlapi-vercel-ai
API Key
Set the AIMLAPI_API_KEY environment variable with your key:
Provider Instance
You can import the default provider instance aimlapi:
Language Models
Create models for text generation with aimlapi and use them with generateText:
Image Generation
You can generate images by calling doGenerate on an image model:
Embeddings
AI/ML API also supports embedding models:
For more information and a full model list, visit the AI/ML API dashboard and the AI/ML API documentation.