fix(core): Include custom headers when loading OpenAI models (backport to release-candidate/2.14.x) - #27539
Closed
n8n-assistant[bot] wants to merge 1 commit into
Closed
fix(core): Include custom headers when loading OpenAI models (backport to release-candidate/2.14.x)#27539n8n-assistant[bot] wants to merge 1 commit into
n8n-assistant[bot] wants to merge 1 commit into
Conversation
(cherry picked from commit f165f6c)
4 tasks
Cadiac
approved these changes
Mar 25, 2026
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant UI as Chat Hub / Canvas UI
participant Server as n8n Backend (searchModels)
participant Creds as Credential Store
participant Config as AiConfig (DI Container)
participant SDK as OpenAI SDK Client
participant API as OpenAI (or Compatible) API
Note over UI, API: Fetching Models for Model Selector
UI->>Server: Request model list (loadOptions)
Server->>Creds: getCredentials()
Creds-->>Server: apiKey, custom headers (headerName, headerValue)
Server->>Config: Get openAiDefaultHeaders
Config-->>Server: global default headers
Note over Server: NEW: mergeCustomHeaders(credentials, globalHeaders)
Server->>Server: Build final header object
Server->>SDK: NEW: Initialize with baseURL & defaultHeaders
Server->>SDK: listModels()
SDK->>API: GET /models (with custom headers)
alt API Success
API-->>SDK: List of models
SDK-->>Server: Model data
Server->>Server: Filter & sort models
Server-->>UI: Return INodeListSearchResult[]
else API Error (e.g., 401/403)
API-->>SDK: Error response
SDK-->>Server: Throw Exception
Server-->>UI: Return empty list / Error toast
end
Cadiac
enabled auto-merge (squash)
March 25, 2026 09:18
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Backport of #27534 to
release-candidate/2.14.x.Checklist for the author (@Cadiac) to go through.
After this PR has been merged, it will be picked up in the next patch release for release track.
Original description
Summary
We were not including custom headers from OpenAI (compatible) credentials when loading models on Chat hub and on canvas node details view resource locators.
This PR fixes that, and changes us to properly include custom headers on OpenAI
loadModelscalls.Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/CHA-171/chathub-model-selector-missing-mergecustomheaders-custom-credential
Review / Merge checklist
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)