Implementation:Langchain ai Langchain OpenAI Model Profiles
| Knowledge Sources | |
|---|---|
| Domains | LLM, OpenAI, Model Configuration |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
OpenAI Model Profiles is an auto-generated data module that defines capability profiles (token limits, modality support, tool calling, structured output) for OpenAI models.
Description
The _profiles.py file in the langchain-openai partner package contains a dictionary named _PROFILES that maps OpenAI model identifiers to their capability metadata. Each profile entry includes maximum input/output token counts, supported input/output modalities (text, image, audio, video), reasoning output capability, tool calling and structured output support, and additional flags for image URL inputs, PDF inputs, PDF tool messages, image tool messages, and tool choice support. This data is auto-generated by the langchain-profiles CLI tool from the models.dev project and should not be manually edited. The profiles are consumed by BaseChatOpenAI and AzureChatOpenAI to automatically set model profile metadata.
Usage
This module is used internally by OpenAI chat model classes during initialization to populate model profiles with appropriate token limits and capability flags. It is not typically imported directly by end users.
Code Reference
Source Location
- Repository: Langchain_ai_Langchain
- File:
libs/partners/openai/langchain_openai/data/_profiles.py - Lines: 1-832
Signature
_PROFILES: dict[str, dict[str, Any]] = {
"model-name": {
"max_input_tokens": int,
"max_output_tokens": int,
"text_inputs": bool,
"image_inputs": bool,
"audio_inputs": bool,
"video_inputs": bool,
"text_outputs": bool,
"image_outputs": bool,
"audio_outputs": bool,
"video_outputs": bool,
"reasoning_output": bool,
"tool_calling": bool,
"structured_output": bool,
"image_url_inputs": bool,
"pdf_inputs": bool,
"pdf_tool_message": bool,
"image_tool_message": bool,
"tool_choice": bool,
},
...
}
Import
from langchain_openai.data._profiles import _PROFILES
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | -- | -- | This is a static data module with no runtime inputs. |
Outputs
| Name | Type | Description |
|---|---|---|
| _PROFILES | dict[str, dict[str, Any]] | A dictionary mapping model name strings to profile dictionaries containing token limits, modality flags, and capability flags. |
Registered Models
The module includes profiles for the following OpenAI models (among others):
| Model | Max Input Tokens | Max Output Tokens | Image Input | Reasoning | Tool Calling | Structured Output |
|---|---|---|---|---|---|---|
| gpt-4o | 128,000 | 16,384 | Yes | No | Yes | Yes |
| gpt-4o-mini | 128,000 | 16,384 | Yes | No | Yes | Yes |
| gpt-4.1 | 1,047,576 | 32,768 | Yes | No | Yes | Yes |
| gpt-4.1-mini | 1,047,576 | 32,768 | Yes | No | Yes | Yes |
| gpt-4.1-nano | 1,047,576 | 32,768 | Yes | No | Yes | Yes |
| gpt-5 | 272,000 | 128,000 | Yes | Yes | Yes | Yes |
| gpt-5-mini | 272,000 | 128,000 | Yes | Yes | Yes | Yes |
| o1 | 200,000 | 100,000 | Yes | Yes | Yes | Yes |
| o3 | 200,000 | 100,000 | Yes | Yes | Yes | Yes |
| o3-mini | 200,000 | 100,000 | No | Yes | Yes | Yes |
| o4-mini | 200,000 | 100,000 | Yes | Yes | Yes | Yes |
| gpt-4 | 8,192 | 8,192 | No | No | Yes | No |
| gpt-3.5-turbo | 16,385 | 4,096 | No | No | No | No |
| text-embedding-3-small | 8,191 | 1,536 | No | No | No | -- |
| text-embedding-3-large | 8,191 | 3,072 | No | No | No | -- |
Usage Examples
Accessing a Model Profile
from langchain_openai.data._profiles import _PROFILES
profile = _PROFILES.get("gpt-4o")
print(profile["max_input_tokens"]) # 128000
print(profile["tool_calling"]) # True
print(profile["structured_output"]) # True
print(profile["image_inputs"]) # True