SpinAI 2.0 and later now supports models all models available via the AI SDK by Vercel. This includes more than 10 different models from multiple providers. Please refer to their documentation for more information.

Note, the AI SDK imports your API keys from environment variables, so you will need to set them in your .env.

Usage

OpenAI example:

import { createAgent } from "spinai";
import { openai } from "@ai-sdk/openai";

const agent = createAgent({
  instructions: "Help users with support tickets",
  actions: [getCustomerInfo, createTicket],
  model: openai("gpt-4o"),
});

const { response } = await agent({
  input: "I want a refund",
});