Skip to content

ModelSettings

type ModelSettings = object;

Settings to use when calling an LLM.

This class holds optional model configuration parameters (e.g. temperature, topP, penalties, truncation, etc.).

Not all models/providers support all of these parameters, so please check the API documentation for the specific model and provider you are using.

contextManagement?: ModelSettingsContextManagement;

Context-management strategies to apply when calling the model. This setting is available on OpenAI Responses requests, including server-side compaction. See https://developers.openai.com/api/docs/guides/compaction.


frequencyPenalty?: number;

The frequency penalty to use when calling the model.


maxTokens?: number;

The maximum number of output tokens to generate.


parallelToolCalls?: boolean;

Whether to use parallel tool calls when calling the model. Defaults to false if not provided.


presencePenalty?: number;

The presence penalty to use when calling the model.


preserveRawUsage?: boolean;

Whether to preserve a JSON-compatible snapshot of provider usage before the Agents SDK normalizes it. Defaults to false if not provided.


promptCacheOptions?: ModelSettingsPromptCacheOptions;

Controls implicit and explicit prompt caching for supported model providers.


promptCacheRetention?: "in-memory" | "24h" | null;

Enables prompt caching and controls how long cached content should be retained by the model provider. See https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention for the available options.


providerData?: Record<string, any>;

Additional provider specific settings to be passed directly to the model request.


reasoning?: ModelSettingsReasoning;

The reasoning settings to use when calling the model.


retry?: ModelRetrySettings;

Runtime-only retry configuration for the model request.


store?: boolean;

Whether to store the generated model response for later retrieval. Defaults to true if not provided.


temperature?: number;

The temperature to use when calling the model.


text?: ModelSettingsText;

The text settings to use when calling the model.


timeoutMs?: number;

Cooperative timeout in milliseconds for each model call. The timeout aborts only the current model call; a run-level abort signal still cancels the entire run. Must be greater than 0 and less than or equal to 2147483647 when provided.


toolChoice?: ModelSettingsToolChoice;

The tool choice to use when calling the model.


topP?: number;

The topP to use when calling the model.


truncation?: "auto" | "disabled";

The truncation strategy to use when calling the model.