# Useful but Little-Known Features of OpenAI Agent SDK
๐ Ever wanted to pass provider-specific parameters that the SDK doesn't directly expose?
With `extra_args`, you can add arbitrary provider-specific fields to `ModelSettings`.
๐ Title: Passing extra_args
๐ URL:
๐งฉ Overview
By passing a dictionary to the `extra_args` parameter of `ModelSettings`, you can send provider-specific request fields that aren't exposed as top-level SDK properties. For example, you can specify OpenAI Responses API fields like `service_tier` or `user`. This lets you use new API parameters without waiting for an SDK update.
๐ How to use it
```python
from agents import Agent, ModelSettings
agent = Agent(
name="English agent",
instructions="You only speak English",
model="gpt-4.1",
model_settings=ModelSettings(
temperature=0.1,
extra_args={
"service_tier": "flex",
"user": "user_12345",
},
),
)
```
๐ Building it into production
ใปUse `service_tier` for cost optimization (e.g., `"flex"` for cheaper low-priority batch processing)
ใปSet the `user` field to enable per-user tracking and abuse detection
ใปAdopt new API parameters immediately on release without waiting for SDK updates
ใปBuild `extra_args` dynamically from environment variables or config files for per-environment tuning
๐ก Use cases
๐ฐ Cost reduction with `service_tier: "flex"` for batch workloads
๐ค Per-user usage tracking via the `user` field
๐ง Early adoption of newly released provider features
๐ข Injecting tenant-specific parameters in multi-tenant environments
โ ๏ธ Watch out
Do not set the same request field through both a direct `ModelSettings` property and `extra_args`. Duplicate settings may cause unexpected behavior. Values passed via `extra_args` must conform to the provider's API specification, as the SDK does not validate them.
โจ With extra_args, unlock provider-specific optimizations beyond the SDK's built-in surface.
#
OpenAIAgentSDK# #
AIAgent#