Fireworks Provider

Fireworks is supported via OpenAI API compatibility - the OpenAI provider is used in the examples below.

The Fireworks provider contains language model support for the Fireworks API. It creates language model objects that can be used with the generateText, streamText, generateObject, and streamObject functions.

Setup

The Fireworks provider is available via the @ai-sdk/openai module as it is compatible with the OpenAI API. You can install it with

pnpm
npm
yarn
pnpm install @ai-sdk/openai

Provider Instance

To use Fireworks, you can create a custom provider instance with the createOpenAI function from @ai-sdk/openai:

import { createOpenAI } from '@ai-sdk/openai';
const fireworks = createOpenAI({
apiKey: process.env.FIREWORKS_API_KEY ?? '',
baseURL: 'https://api.fireworks.ai/inference/v1',
});

Models

You can create Fireworks models using a provider instance. The first argument is the model id, e.g. accounts/fireworks/models/firefunction-v1.

const model = fireworks('accounts/fireworks/models/firefunction-v1');