Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI Tools · Function

createFireworks

createFireworks builds a customized Fireworks provider for the AI SDK. Configure credentials, endpoint routing, headers, or request handling, then use the returned provider to create Fireworks models.

How it works

createFireworks creates a customized Fireworks provider instance from @ai-sdk/fireworks. Pass provider settings such as an API key, an alternate API base URL, custom headers, or a replacement fetch implementation; the returned provider can then create Fireworks language models.

Syntax

createFireworks(options)

Parameters

NameTypeDescription
optionsobjectOptional provider configuration, including baseURL, apiKey, headers, and fetch.

Returns

A customized Fireworks provider instance.

Key points

  • Install and import the provider from the dedicated @ai-sdk/fireworks package.
  • Use createFireworks when the default provider instance does not provide the required configuration.
  • baseURL supports routing requests through a proxy or another compatible endpoint.
  • apiKey configures the credential transmitted through the Authorization header.
  • headers lets the provider add or override HTTP headers for its requests.
  • fetch allows callers to replace the request implementation.

Common mistakes

  • If apiKey is omitted, authentication uses the FIREWORKS_API_KEY environment variable.
  • Changing baseURL changes the URL prefix used for provider API calls.

Example: Create a customized Fireworks provider

import { createFireworks } from '@ai-sdk/fireworks';

const fireworks = createFireworks({
  apiKey: process.env.FIREWORKS_API_KEY ?? '',
});

const model = fireworks('accounts/fireworks/models/llama-v3p1-8b-instruct');

Creates a customized Fireworks provider and uses it to select a Fireworks model.

When to use it

Configure API authentication

A server needs explicit credential configuration instead of relying on the default provider.

Route through a proxy

Requests must pass through an internal gateway or compatible endpoint.

Customize requests

An application needs provider-specific headers or custom request instrumentation.

Interview questions

QWhat does createFireworks provide?

createFireworks is the factory for a customized Fireworks provider instance. Import it from @ai-sdk/fireworks and pass provider settings such as apiKey.

Follow-up: How can the provider be adapted to a proxy? Set baseURL to the proxy's URL prefix.

QHow is authentication configured?

The apiKey setting supplies the credential sent in the Authorization header. When it is not supplied, the provider reads FIREWORKS_API_KEY.

Follow-up: What happens if a deployment needs custom request behavior? Supply a fetch implementation in the provider settings.

QHow is the created provider used?

The returned provider is callable with a model identifier, producing a Fireworks model for use with AI SDK operations. The factory itself configures the provider rather than generating model output.

Follow-up: Which other provider settings can be customized? baseURL, headers, and fetch are also documented options.

  • fireworks
  • @ai-sdk/fireworks
  • baseURL
  • apiKey
  • headers
  • fetch

Source: Fireworks. Checked 2026-10-15.