Enabled when
OPENAI_API_KEY is set in your environment.Overview
The@standardagents/openai package provides the OpenAI provider factory for Standard Agents. It enables direct access to OpenAI models with typed providerOptions and built-in provider tools.
Key Features
- Direct OpenAI API access with automatic client management
- Typed
providerOptionswith TypeScript autocompletion - Built-in provider tools (web search, file search, code interpreter, image generation)
- Model capability detection and icon support
Installation
npm
pnpm
yarn
Quick Start
agents/models/gpt_5_4.ts
Provider Factory
Theopenai export is a provider factory function that creates OpenAI provider instances:
Unlike the legacy string-based
provider: 'openai', the new API uses an imported factory function. This enables typed providerOptions and runtime validation.Provider Options
Theopenai factory includes a typed schema for provider-specific options:
Available Options
| Option | Type | Description |
|---|---|---|
service_tier | 'auto' | 'default' | 'flex' | Service tier for request processing |
user | string | User identifier for abuse monitoring |
seed | number | Seed for deterministic outputs (beta) |
frequency_penalty | number | Reduces repetition (-2.0 to 2.0) |
presence_penalty | number | Encourages new topics (-2.0 to 2.0) |
logprobs | boolean | Return log probabilities |
top_logprobs | number | Most likely tokens to return (0-20) |
store | boolean | Store completion for future reference |
metadata | Record<string, string> | Metadata for stored completions |
Type Safety
TheproviderOptions type is automatically inferred from the provider:
Provider Tools
OpenAI provides built-in tools that execute on OpenAI’s servers and can be used alongside your custom tools:| Tool | Description | Required tenvs |
|---|---|---|
web_search | Search the web for up-to-date information with citations | userLocation (optional) |
file_search | Search uploaded files using vector embeddings | vectorStoreId (required) |
code_interpreter | Execute Python in a sandboxed container | containerId (optional) |
image_generation | Generate images via gpt-image-1 | — |
All current GPT-5.4 models (
gpt-5.4, gpt-5.4-mini, gpt-5.4-nano) support these built-in tools. See OpenAI’s tool documentation for the current per-model compatibility matrix.Using Provider Tools
Enable provider tools in your model definition:Tool Requirements
Some provider tools require thread environment variables (tenvs): file_search:Provider tools are executed by OpenAI’s servers, not locally. Results come back in the API response.
Model Capabilities
Set capabilities to help the framework understand what the model supports:Environment Setup
Set your OpenAI API key as an environment variable:.dev.vars
Example Configurations
High-Performance Model
Budget Model
Reasoning Model
Exports
Next Steps
Models
Learn about model configuration
OpenRouter
Access multiple providers via OpenRouter
Tools
Create custom tools
defineModel API
Complete API reference