Setup
Streaming
UsestreamText to render tokens as they arrive, which is ideal for chat UIs:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Uncensored image & video generation is now live in the API. Browse the models →
Use Deepshi models with the Vercel AI SDK.
npm install ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const deepshi = createOpenAICompatible({
name: "deepshi",
baseURL: "https://api.deepshi.ai/v1",
apiKey: process.env.DEEPSHI_API_KEY,
});
const { text } = await generateText({
model: deepshi("deepshi-3.0"),
prompt: "Write a haiku about the sea.",
});
console.log(text);
streamText to render tokens as they arrive, which is ideal for chat UIs:
import { streamText } from "ai";
const result = streamText({
model: deepshi("deepshi-3.0"),
prompt: "Explain backpropagation.",
});
for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}
Was this page helpful?