The Chutes.ai Provider for Vercel AI SDK allows you to use open-source AI models hosted on Chutes.ai with the Vercel AI SDK. It supports a wide range of capabilities including chat, streaming, tool calling, and multimodal generation.
Features
✅ Language Models: Complete support for chat and text completion
import { generateText } from"ai";
const model = chutes("https://chutes-deepseek-ai-deepseek-v3.chutes.ai");
const result = awaitgenerateText({
model,
prompt: "Explain quantum computing in simple terms",
});
console.log(result.text);
Streaming Responses
Stream responses in real-time for a better user experience.
import { streamText } from"ai";
const result = awaitstreamText({
model: chutes("https://chutes-meta-llama-llama-3-1-70b-instruct.chutes.ai"),
prompt: "Write a story about a space traveler.",
});
forawait (const chunk of result.textStream) {
process.stdout.write(chunk);
}
Tool Calling
Connect LLMs to external data and functions.
import { z } from"zod";
const result = awaitgenerateText({
model: chutes("https://chutes-deepseek-ai-deepseek-v3.chutes.ai"),
tools: {
getWeather: {
description: "Get the current weather",
parameters: z.object({
location: z.string().describe("City name"),
}),
execute: async ({ location }) => {
return { temp: 72, condition: "Sunny", location };
},
},
},
prompt: "What is the weather in San Francisco?",
});
Multimodal Capabilities
Image Generation
Generate images using models like FLUX.
import * as fs from"fs";
const imageModel = chutes.imageModel("flux-dev");
const result = await imageModel.doGenerate({
prompt: "A cyberpunk city with neon lights and flying cars",
size: "1024x1024",
});
const base64Data = result.images[0].split(",")[1];
fs.writeFileSync("city.png", Buffer.from(base64Data, "base64"));
Text-to-Speech (TTS)
Convert text to speech using over 50 available voices.
const audioModel = chutes.audioModel("your-tts-chute-id");
const result = await audioModel.textToSpeech({
text: "Welcome to the future of AI.",
voice: "af_bella", // American Female - Bella
});
fs.writeFileSync("output.mp3", result.audio);
// Warm up a chuteconst result = await chutes.therm.warmup("your-chute-id");
if (result.isHot) {
console.log("Chute is ready!");
} else {
console.log("Warming up...");
}