QuickStart: 15 lines of code
- Install both the Vercel AI SDK and the Together AI provider package.
- Import the Together AI provider and call the
generateTextfunction with Kimi K2 to generate some text.
TypeScript
Output
Streaming with the Vercel AI SDK
To stream from Together AI models using the Vercel AI SDK, simply usestreamText as seen below.
TypeScript
Output
Image Generation
To generate images with Together AI models using the Vercel AI SDK, use the.image() factory method. For more on image generation with the AI SDK see generateImage().
TypeScript
providerOptions argument.
TypeScript
black-forest-labs/FLUX.1-schnellblack-forest-labs/FLUX.1.1-problack-forest-labs/FLUX.1-kontext-problack-forest-labs/FLUX.1-kontext-maxblack-forest-labs/FLUX.1-krea-dev
Embedding Models
To embed text with Together AI models using the Vercel AI SDK, use the.embeddingModel() factory method.
For more on embedding models with the AI SDK see embed().
TypeScript
For a complete list of available embedding models and their model IDs, see the Together AI models
page.
intfloat/multilingual-e5-large-instruct