@ai-sdk/fireworks
Version:
The **[Fireworks provider](https://ai-sdk.dev/providers/ai-sdk-providers/fireworks)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model and image model support for the [Fireworks](https://fireworks.ai) platform.
98 lines (89 loc) • 4.84 kB
text/typescript
import { z } from 'zod/v4';
import { ImageModelV3, ProviderV3, LanguageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
import { FetchFunction } from '@ai-sdk/provider-utils';
type FireworksEmbeddingModelId = 'nomic-ai/nomic-embed-text-v1.5' | (string & {});
declare const fireworksEmbeddingProviderOptions: z.ZodObject<{}, z.core.$strip>;
type FireworksEmbeddingProviderOptions = z.infer<typeof fireworksEmbeddingProviderOptions>;
type FireworksImageModelId = 'accounts/fireworks/models/flux-1-dev-fp8' | 'accounts/fireworks/models/flux-1-schnell-fp8' | 'accounts/fireworks/models/flux-kontext-pro' | 'accounts/fireworks/models/flux-kontext-max' | 'accounts/fireworks/models/playground-v2-5-1024px-aesthetic' | 'accounts/fireworks/models/japanese-stable-diffusion-xl' | 'accounts/fireworks/models/playground-v2-1024px-aesthetic' | 'accounts/fireworks/models/SSD-1B' | 'accounts/fireworks/models/stable-diffusion-xl-1024-v1-0' | (string & {});
interface FireworksImageModelConfig {
provider: string;
baseURL: string;
headers: () => Record<string, string>;
fetch?: FetchFunction;
_internal?: {
currentDate?: () => Date;
};
}
declare class FireworksImageModel implements ImageModelV3 {
readonly modelId: FireworksImageModelId;
private config;
readonly specificationVersion = "v3";
readonly maxImagesPerCall = 1;
get provider(): string;
constructor(modelId: FireworksImageModelId, config: FireworksImageModelConfig);
doGenerate({ prompt, n, size, aspectRatio, seed, providerOptions, headers, abortSignal, files, mask, }: Parameters<ImageModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<ImageModelV3['doGenerate']>>>;
}
type FireworksChatModelId = 'accounts/fireworks/models/deepseek-v3' | 'accounts/fireworks/models/llama-v3p3-70b-instruct' | 'accounts/fireworks/models/llama-v3p2-3b-instruct' | 'accounts/fireworks/models/llama-v3p1-405b-instruct' | 'accounts/fireworks/models/llama-v3p1-8b-instruct' | 'accounts/fireworks/models/mixtral-8x7b-instruct' | 'accounts/fireworks/models/mixtral-8x22b-instruct' | 'accounts/fireworks/models/mixtral-8x7b-instruct-hf' | 'accounts/fireworks/models/qwen2p5-coder-32b-instruct' | 'accounts/fireworks/models/qwen2p5-72b-instruct' | 'accounts/fireworks/models/qwen-qwq-32b-preview' | 'accounts/fireworks/models/qwen2-vl-72b-instruct' | 'accounts/fireworks/models/llama-v3p2-11b-vision-instruct' | 'accounts/fireworks/models/qwq-32b' | 'accounts/fireworks/models/yi-large' | 'accounts/fireworks/models/kimi-k2-instruct' | (string & {});
type FireworksCompletionModelId = 'accounts/fireworks/models/llama-v3-8b-instruct' | 'accounts/fireworks/models/llama-v2-34b-code' | (string & {});
type FireworksErrorData = z.infer<typeof fireworksErrorSchema>;
declare const fireworksErrorSchema: z.ZodObject<{
error: z.ZodString;
}, z.core.$strip>;
interface FireworksProviderSettings {
/**
Fireworks API key. Default value is taken from the `FIREWORKS_API_KEY`
environment variable.
*/
apiKey?: string;
/**
Base URL for the API calls.
*/
baseURL?: string;
/**
Custom headers to include in the requests.
*/
headers?: Record<string, string>;
/**
Custom fetch implementation. You can use it as a middleware to intercept requests,
or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: FetchFunction;
}
interface FireworksProvider extends ProviderV3 {
/**
Creates a model for text generation.
*/
(modelId: FireworksChatModelId): LanguageModelV3;
/**
Creates a chat model for text generation.
*/
chatModel(modelId: FireworksChatModelId): LanguageModelV3;
/**
Creates a completion model for text generation.
*/
completionModel(modelId: FireworksCompletionModelId): LanguageModelV3;
/**
Creates a chat model for text generation.
*/
languageModel(modelId: FireworksChatModelId): LanguageModelV3;
/**
Creates a text embedding model for text generation.
*/
embeddingModel(modelId: FireworksEmbeddingModelId): EmbeddingModelV3;
/**
* @deprecated Use `embeddingModel` instead.
*/
textEmbeddingModel(modelId: FireworksEmbeddingModelId): EmbeddingModelV3;
/**
Creates a model for image generation.
*/
image(modelId: FireworksImageModelId): ImageModelV3;
/**
Creates a model for image generation.
*/
imageModel(modelId: FireworksImageModelId): ImageModelV3;
}
declare function createFireworks(options?: FireworksProviderSettings): FireworksProvider;
declare const fireworks: FireworksProvider;
declare const VERSION: string;
export { type FireworksEmbeddingModelId, type FireworksEmbeddingProviderOptions, type FireworksErrorData, FireworksImageModel, type FireworksImageModelId, type FireworksProvider, type FireworksProviderSettings, VERSION, createFireworks, fireworks };