OpenAI
To get your OpenAI API key, you need to:
- Go to https://platform.openai.com/account/api-keys
- Create an account or log in with your existing one
- Add a payment method to your account
- Go to https://platform.openai.com/api-keys to get a key.
- You will need to set the following environment variable to your key, or you can set it to
user_providedfor users to provide their own.
OPENAI_API_KEY=user_providedWhere users enter their own key
With user_provided, you supply no key at all: each user enters their own from the chat UI. Open the endpoint menu, and next to OpenAI there is a gear icon labelled Set API Key. Clicking it opens a dialog with a field for the key and a dropdown for how long it should be kept: 30 minutes, 2 hours, 12 hours (the default), 1 day, 7 days, 30 days, or never expire.
The key is encrypted and stored server-side against that user's account, so it is entered once rather than per conversation, and it is never shared with other users. The same dialog has a Revoke action, plus Revoke All to clear every key that user has stored.
If the endpoint menu is hidden, for example because a model spec disables modelSelect, the same dialog is reachable from Settings under Data controls, in the API keys section.
Until a user sets a key, the endpoint is visible but unusable for them.
- You can determine which models you would like to have available with
OPENAI_MODELS- When
OPENAI_API_KEYis set touser_providedβ only the models put in this list will be available- β οΈNew models won't automatically show up; you'll need to add them to this list first
- When
OPENAI_API_KEYis set to the actual API key value β as long asOPENAI_MODELSis left commented-out, it will do an API call to find out what models are available, which should include any new ones
- When
OPENAI_MODELS=gpt-6-astra,gpt-6.1-sol,gpt-6-sol,gpt-6-luna,gpt-5.6,gpt-5.6-terra,gpt-5.6-luna,gpt-5.5,gpt-5.5-pro,chat-latest,gpt-5.4,gpt-5.4-pro,gpt-5.4-mini,gpt-5.4-nano,gpt-5.3-codex,gpt-5.2,gpt-5,gpt-5-codex,gpt-5-mini,gpt-5-nano,o3-pro,o3,o4-mini,gpt-4.1,gpt-4.1-mini,gpt-4.1-nano,o3-mini,o1-pro,o1,gpt-4o,gpt-4o-miniYou can also set the list in librechat.yaml with endpoints.openAI.models, an array of model IDs. A list configured there replaces OPENAI_MODELS and skips the API call that discovers models. The list is read from the configuration resolved for each request, so a configuration override applied to a role or group can narrow it for those users.
endpoints:
openAI:
models:
- gpt-6-astra
- gpt-5.6
- gpt-4oNotes:
-
GPT-6.1 Sol (
gpt-6.1-sol) joins the canonical OpenAI and Agents default catalogs, not Assistants. Until explicit entries are added, it inherits GPT-6 Sol's context/output limits and pricing; these are family fallbacks, not independently confirmed GPT-6.1 pricing. -
GPT point releases with no matching per-release entry inherit their recognized family's context/output limits, pricing, and reasoning settings. Explicit entries take precedence. For example,
gpt-6.1-solno longer falls back to the generic 32K context budget. Undated point releases on native OpenAI can also inherit the family's Responses policy; dated snapshots retain wildcard-policy inheritance, Azure stays deployment-specific, and custom endpoints are not switched automatically. -
Internal OpenAI defaults include
gpt-6-astrafor the canonical OpenAI and Agents endpoints. LibreChat routes every Astra request through the Responses API because its tool calls are Responses-only, removes unsupported sampling parameters, and applies a 1,050,000-token context window with a 128,000-token maximum output. Astra is intentionally excluded from the Assistants, Azure Assistants, and Azure OpenAI default catalogs. -
Internal OpenAI defaults include
gpt-5.6,gpt-5.6-terra, andgpt-5.6-luna, followed by the existing GPT-5 catalog.gpt-5.6is the Sol tier alias; LibreChat assigns all three GPT-5.6 tiers a 1,050,000-token context window and 128,000-token maximum output. Deprecated legacy defaults are no longer included unless you add them explicitly withOPENAI_MODELS. -
GPT-5.6 supports the Responses API-only
reasoning_modevaluesstandardandpro, plusreasoning_contextvaluesauto,current_turn, andall_turns. These can be configured in model specs. -
For a GPT-5.6 model with a non-
nonereasoning_effort, LibreChat defaults the canonical OpenAI endpoint to the Responses API so function tools remain compatible. An explicituseResponsesApi: falsekeeps Chat Completions. Azure OpenAI, OpenRouter, and custom or reverse-proxy base URLs are not switched automatically. -
Selecting a vision model for messages with attachments is not necessary as it will be switched behind the scenes for you. If you didn't outright select a vision model, it will only be used for the vision request and you should still see the non-vision model you had selected after the request is successful
-
OpenAI Vision models allow for messages without attachments
-
OpenAI endpoint supports all Shared Endpoint Settings via the
librechat.yamlconfiguration file, includingstreamRate,headers,titleModel,titleMethod,titlePrompt,titlePromptTemplate, andtitleEndpoint
How is this guide?