OpenAILike connects to any provider that exposes an OpenAI-compatible Chat Completions API. It extends OpenAIChat and is the base class for providers such as DeepSeek, Fireworks, Together, and xAI. Provider reference pages document only their own defaults and additions. These constructor parameters are inherited; each adapter and provider determines which are forwarded and supported. Check the provider reference before using structured output, background processing, or response storage.
Parameter Type Default Description idstr"not-provided"The id of the model to use namestr"OpenAILike"The name of the model providerstr"OpenAI"The provider of the model model_typeModelTypeModelType.MODELFunctional role of the model (e.g. MODEL, OUTPUT_MODEL, PARSER_MODEL, MEMORY_MODEL). Set by the agent during initialization supports_native_structured_outputsboolTrueWhether the model supports native structured outputs supports_json_schema_outputsboolFalseWhether the model requires a JSON schema for structured outputs system_promptOptional[str]NoneSystem prompt from the model, added to the Agent instructionsOptional[List[str]]NoneInstructions from the model, added to the Agent tool_message_rolestr"tool"Role assigned to tool messages assistant_message_rolestr"assistant"Role assigned to assistant messages role_mapOptional[Dict[str, str]]NoneCustom mapping of message roles to provider roles collect_metrics_on_completionboolFalseCollect token metrics only from the final streaming chunk (for providers with cumulative token counts)
Parameter Type Default Description storeOptional[bool]NoneWhether to store the output of the request on the provider side reasoning_effortOptional[ReasoningEffort]NoneModel-dependent reasoning effort; use values supported by the selected provider and model. verbosityOptional[Verbosity]NoneVerbosity level of the model response metadataOptional[Dict[str, Any]]NoneDeveloper-defined metadata to associate with the completion frequency_penaltyOptional[float]NonePenalizes new tokens based on their frequency in the text so far (-2.0 to 2.0) logit_biasOptional[Any]NoneModifies the likelihood of specified tokens appearing in the completion logprobsOptional[bool]NoneWhether to return log probabilities of the output tokens top_logprobsOptional[int]NoneNumber of most likely tokens to return log probabilities for (0 to 20) max_tokensOptional[int]NoneMaximum number of tokens to generate (deprecated, use max_completion_tokens) max_completion_tokensOptional[int]NoneMaximum number of completion tokens to generate, including reasoning tokens modalitiesOptional[List[str]]NoneOutput modalities: "text" and/or "audio" audioOptional[Dict[str, Any]]NoneAudio output configuration (e.g. {"voice": "alloy", "format": "wav"}) presence_penaltyOptional[float]NonePenalizes new tokens based on whether they appear in the text so far (-2.0 to 2.0) seedOptional[int]NoneBest-effort repeatability; identical requests may still produce different results. stopOptional[Union[str, List[str]]]NoneUp to 4 sequences where the API stops generating further tokens temperatureOptional[float]NoneControls randomness in the model's output userOptional[str]NoneA unique identifier representing your end-user top_pOptional[float]NoneControls diversity via nucleus sampling service_tierOptional[ServiceTier]NoneProcessing tier for the request ("auto", "default", "flex", "priority") strict_outputboolTrueRequests strict schema handling when a supported structured-output path is used; provider and model support still apply. extra_headersOptional[Any]NoneAdditional headers to include in requests extra_queryOptional[Any]NoneAdditional query parameters to include in requests extra_bodyOptional[Any]NoneAdditional body parameters to include in requests request_paramsOptional[Dict[str, Any]]NoneAdditional parameters merged into the request
Parameter Type Default Description api_keyOptional[str]"not-provided"The API key for authentication organizationOptional[str]NoneThe organization ID to use for requests base_urlOptional[Union[str, httpx.URL]]NoneThe base URL of the OpenAI-compatible endpoint timeoutOptional[float]NoneRequest timeout in seconds max_retriesOptional[int]NoneMaximum number of client-level retries for failed requests default_headersOptional[Any]NoneDefault headers to include in all requests default_queryOptional[Any]NoneDefault query parameters to include in all requests http_clientOptional[Union[httpx.Client, httpx.AsyncClient]]NoneHTTP client instance for making requests client_paramsOptional[Dict[str, Any]]NoneAdditional parameters for client configuration clientOptional[OpenAI]NonePre-configured sync OpenAI client, reused across requests async_clientOptional[AsyncOpenAI]NonePre-configured async OpenAI client, reused across requests
Parameter Type Default Description cache_responseboolFalseCache model responses to avoid redundant API calls during development cache_ttlOptional[int]NoneTime-to-live for cached responses, in seconds. None keeps cached entries forever cache_dirOptional[str]NoneDirectory for cached responses. Defaults to ~/.agno/cache/model_responses
Parameter Type Default Description retriesint0Number of retries to attempt before raising a ModelProviderError delay_between_retriesint1Delay between retries, in seconds exponential_backoffboolFalseIf True, the delay between retries is doubled each time retry_with_guidanceboolTrueRetry a failed invocation with a guidance message appended, for known errors avoidable with extra instructions retry_with_guidance_limitint1Maximum number of retries with guidance
The string-compatible types ReasoningEffort, ReasoningSummary, ServiceTier, and Verbosity are defined in agno.models.openai.types. Accepted API values depend on the selected model; see the provider's API reference.
Try the Docs Agent, powered by Agno