new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

fireworks/options

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Fireworks provider options for language models

Fireworks language models support additional provider options passed via the `providerOptions` argument with the structure `{ fireworks: { ... } }`. Options include promptCacheKey (string), serviceTier ('priority'), thinking (object with type and budgetTokens), and reasoningHistory ('disabled' | 'interleaved' | 'preserved').

Fireworks promptCacheKey option

The promptCacheKey option is a stable, opaque string that improves prompt cache hit rates by routing requests with shared prompt prefixes to the same Fireworks replica. Use the same key for all steps and calls in one conversation, and different keys for unrelated conversations.

Fireworks serviceTier option

The serviceTier option accepts the value 'priority' to use the Fireworks Priority serving path for higher reliability during peak traffic. The provider sends it as Fireworks' `service_tier` request field.

Fireworks thinking option configuration

The thinking option is an object for configuration of thinking/reasoning models like Kimi K2.6. It contains: type ('enabled' | 'disabled') for whether to enable thinking mode, and budgetTokens (number, minimum 1024) for maximum tokens for thinking.

Fireworks reasoningHistory option

The reasoningHistory option controls how reasoning history is handled in multi-turn conversations with three values: 'disabled' (remove reasoning from history), 'interleaved' (include reasoning between tool calls within a single turn), or 'preserved' (keep all reasoning in history).

Fireworks thinking provider option example

Example using thinking provider options: ```ts import { fireworks, type FireworksLanguageModelOptions } from '@ai-sdk/fireworks'; import { generateText } from 'ai'; const { text, reasoningText } = await generateText({ model: fireworks('accounts/fireworks/models/kimi-k2p6'), providerOptions: { fireworks: { thinking: { type: 'enabled', budgetTokens: 4096 }, reasoningHistory: 'interleaved', } satisfies FireworksLanguageModelOptions, }, prompt: 'How many "r"s are in the word "strawberry"?', }); ```

Fireworks prompt cache affinity example

Example using promptCacheKey for prompt caching in a multi-step generateText call: ```ts import { fireworks, type FireworksLanguageModelOptions } from '@ai-sdk/fireworks'; import { generateText, isStepCount, tool } from 'ai'; import { z } from 'zod'; const sessionId = 'conversation-123'; const result = await generateText({ model: fireworks('accounts/fireworks/models/kimi-k2p6'), providerOptions: { fireworks: { promptCacheKey: sessionId, } satisfies FireworksLanguageModelOptions, }, tools: { weather: tool({ description: 'Get the weather for a city.', inputSchema: z.object({ city: z.string() }), execute: async ({ city }) => `It is sunny in ${city}.`, }), }, stopWhen: isStepCount(5), prompt: 'What is the weather in San Francisco?', }); console.log(result.usage.inputTokenDetails.cacheReadTokens); ```

Fireworks ToolLoopAgent with prompt cache

Example using ToolLoopAgent with prompt caching: ```ts import { fireworks, type FireworksLanguageModelOptions } from '@ai-sdk/fireworks'; import { ToolLoopAgent } from 'ai'; import { z } from 'zod'; import { weatherTool } from './weather-tool'; const agent = new ToolLoopAgent({ model: fireworks('accounts/fireworks/models/kimi-k2p6'), callOptionsSchema: z.object({ sessionId: z.string(), }), prepareCall: ({ options, ...settings }) => ({ ...settings, providerOptions: { fireworks: { promptCacheKey: options.sessionId, } satisfies FireworksLanguageModelOptions, }, }), tools: { weather: weatherTool }, }); const result = await agent.generate({ prompt: 'What is the weather in San Francisco?', options: { sessionId: 'conversation-123', }, }); ```

Fireworks Priority service tier example

Example using Priority service tier: ```ts import { fireworks, type FireworksLanguageModelOptions } from '@ai-sdk/fireworks'; import { generateText } from 'ai'; const result = await generateText({ model: fireworks('accounts/fireworks/models/glm-5p2'), providerOptions: { fireworks: { serviceTier: 'priority', } satisfies FireworksLanguageModelOptions, }, prompt: 'Write a haiku about reliable inference.', }); ```

Fireworks image model provider options

Fireworks image models support flexible provider options through `providerOptions.fireworks`. Typed provider options include: guidance_scale (number), num_inference_steps (number), output_format ('jpeg' | 'png'), prompt_upsampling (boolean), safety_tolerance (number, 0-6, limited to 2 for image-to-image), webhook_url (string), webhook_secret (string), cfg_scale (number), and steps (number).

Give your agent this brain