UNPKG

ai

Version:

AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.

31 lines (18 loc) 496 B
--- title: generateId description: Generate a unique identifier (API Reference) --- # `generateId()` Generates a unique identifier. This is the same id generator used by the AI SDK. ```ts import { generateId } from 'ai'; const id = generateId(); ``` ## Import <Snippet text={`import { generateId } from "ai"`} prompt={false} /> ## API Signature ### Returns A string representing the generated ID. ## See also - [`createIdGenerator()`](/docs/reference/ai-sdk-core/create-id-generator)