-
Notifications
You must be signed in to change notification settings - Fork 67
feat: Add custom HTTP headers support per LLM service instance #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vpecinka
wants to merge
19
commits into
mattermost:master
Choose a base branch
from
vpecinka:feature/custom-headers-per-service
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Add custom HTTP headers support per LLM service instance #357
vpecinka
wants to merge
19
commits into
mattermost:master
from
vpecinka:feature/custom-headers-per-service
Conversation
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
Implements custom HTTP headers functionality as requested in issue mattermost#343. Each LLM service instance (bot configuration) can now have independent custom headers that are sent with every API request to the provider. ## Backend Changes: - Added customHeaders field to ServiceConfig and all provider configs - Implemented HTTP client wrapper to inject custom headers into requests - Updated config transformation to preserve customHeaders across saves - Added comprehensive unit and integration tests - Supports all providers: OpenAI, Anthropic, ASage, OpenAI Compatible ## Frontend Changes: - Added CustomHeadersItem React component for header management - Integrated custom headers editor into System Console bot configuration - Fixed focus issues with dynamic header key editing - Updated TypeScript types to include customHeaders field ## Key Features: - Per-service instance custom headers (independent between bots) - Headers preserved during config save/load operations - User-friendly UI for adding/editing/removing headers - Comprehensive validation and error handling - Full test coverage including multiple instance scenarios ## Use Cases: - Authentication tokens specific to different API endpoints - Request tracking and routing headers - Organization-specific headers for multi-tenant setups - Custom metadata for monitoring and analytics Closes mattermost#343
crspeller
requested changes
Aug 12, 2025
Member
crspeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! I think we just need to clean it up a little.
Move duplicate customHeadersTransport implementations from OpenAI, Anthropic, and ASage backends to shared httpexternal.WrapHTTPClientWithCustomHeaders function.
Inter-plugin client calls were failing when agents had tools enabled because the inter-plugin API uses ChatCompletionNoStream which internally calls ReadAll, and ReadAll explicitly rejects tool call events with an error. This created an architecture mismatch where regular conversations use streaming to handle tools properly, but inter-plugin requests use non-streaming which cannot handle tools. The fix adds a WithLLMContextNoTools context option that allows inter-plugin requests to disable tools for that specific session only, without affecting the bot's overall tool configuration. This preserves the bot's ability to use tools in regular interactive conversations while allowing inter-plugin clients to work with simple completion requests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <[email protected]>
* Update admin_guide.md added note reg rendering of URL links via the plugin * Update admin_guide.md * Update docs/admin_guide.md --------- Co-authored-by: Carrie Warner (Mattermost) <[email protected]>
* Update Agents to leverage official OpenAI SDK rather than third party one * Fixes * Fix embeddings propogation of dimensions * Update openai/openai.go Co-authored-by: Copilot <[email protected]> * Fix linter * Attempt to fix e2e * fix more e2e * Move output of deltas before checking finishing conditions * lint * Fix azure * PR feedback * Fix function calling for tools with no parameters. Add test to cover case * One more PR Feedback --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Christopher Speller <[email protected]>
Move duplicate customHeadersTransport implementations from OpenAI, Anthropic, and ASage backends to shared httpexternal.WrapHTTPClientWithCustomHeaders function.
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.
Implements custom HTTP headers functionality as requested in issue #343. Each LLM service instance (bot configuration) can now have independent custom headers that are sent with every API request to the provider.
Backend Changes:
Frontend Changes:
Key Features:
Use Cases:
Closes #343
Closes #
Description