Skip to content

Add Support for Custom Headers #56

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

Merged
merged 1 commit into from
Jun 5, 2025

Conversation

maerch
Copy link
Member

@maerch maerch commented Jun 5, 2025

  • Introduces a common provider configuration as a starting point for all provider
  • Adds headers configuration to all available providers

@maerch maerch self-assigned this Jun 5, 2025
Copy link

vercel bot commented Jun 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
plugins-web ✅ Ready (Inspect) Visit Preview Jun 5, 2025 7:53am

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for custom HTTP headers for all providers. Key changes include the addition of a headers field to the common provider configuration, updates to merge custom headers into API requests across multiple provider files, and corresponding documentation updates in the tutorial and README.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/plugin-ai-video-generation-web/src/fal-ai/createVideoProvider.ts Adds headers support and merges custom headers in video provider initialization.
packages/plugin-ai-video-generation-web/src/fal-ai/PixverseV35TextToVideo.ts Passes custom headers to the provider configuration.
packages/plugin-ai-video-generation-web/src/fal-ai/MinimaxVideo01LiveImageToVideo.ts Propagates headers into the provider initialization.
packages/plugin-ai-video-generation-web/src/fal-ai/MinimaxVideo01Live.ts Adds headers to configuration for live video processing.
packages/plugin-ai-text-generation-web/src/anthropic/sendPrompt.ts Merges custom headers into Anthropics API requests and adjusts header types.
packages/plugin-ai-text-generation-web/src/anthropic/AnthropicProvider.ts Passes headers from the configuration to the API call.
packages/plugin-ai-image-generation-web/src/open-ai/GptImage1.text2image.ts Adds headers to API request configurations for image generation.
packages/plugin-ai-image-generation-web/src/open-ai/GptImage1.image2image.ts Merges custom headers into the API request for image-to-image operations.
packages/plugin-ai-image-generation-web/src/fal-ai/createImageProvider.ts Integrates custom headers into image provider initialization.
packages/plugin-ai-generation-web/src/fal-ai/RecraftV3.ts Adds custom headers into provider initialization for image generation.
packages/plugin-ai-generation-web/src/fal-ai/GeminiFlashEdit.ts Passes headers to the provider for flash edit features.
packages/plugin-ai-generation-web/src/index.ts Re-exports the updated CommonProviderConfiguration.
packages/plugin-ai-generation-web/src/generation/types.ts Defines the CommonProviderConfiguration interface with the headers field.
packages/plugin-ai-generation-web/TUTORIAL.md Updates tutorial sections to document the new headers configuration and its usage.
packages/plugin-ai-generation-web/README.md Enhances documentation to include examples for setting custom headers.
packages/plugin-ai-audio-generation-web/src/elevenlabs/ElevenSoundEffects.ts Merges custom headers in audio API requests.
packages/plugin-ai-audio-generation-web/src/elevenlabs/ElevenMultilingualV2.ts Integrates custom headers into audio generation requests.
CHANGELOG-AI.md Adds an entry documenting the new custom headers support feature.
Comments suppressed due to low confidence (3)

packages/plugin-ai-video-generation-web/src/fal-ai/createVideoProvider.ts:64

  • [nitpick] Confirm that the custom headers merging order meets the intended precedence and document whether custom headers should override the defaults or vice versa.
headers: { ...request.headers, ...(options.headers ?? {}) }

packages/plugin-ai-text-generation-web/src/anthropic/sendPrompt.ts:56

  • Review header type definitions for consistency; consider aligning the header type in sendPrompt with that in CommonProviderConfiguration to ensure uniformity.
headers: { ...(DEFAULT_ANTHROPIC_OPTIONS.headers ?? {}), ...config.headers }

packages/plugin-ai-generation-web/README.md:49

  • [nitpick] Ensure that the documentation clearly explains the header merge behavior and the significance of header ordering when combining custom headers with required defaults.
headers: { 'x-custom-header': 'value', 'x-client-version': '1.0.0' }

@maerch maerch merged commit 65ec9b4 into main Jun 5, 2025
8 checks passed
@maerch maerch deleted the feature/custom-headers-for-ai-providers branch June 5, 2025 09:27
maerch added a commit that referenced this pull request Jun 5, 2025
maerch added a commit that referenced this pull request Jun 5, 2025
* Allow an undefined schema (so the custom render function can take over)

* Add `order` provider configuration and test for `getProperties`

* Export helper `isAsyncGenerator`

* Add new CommonProperty `StyleTransfer`

* Add PhotoEditor example

* Update examples/web/src/pages/PhotoEditorPlugin.ts

Co-authored-by: Copilot <[email protected]>

* Add support for custom headers (#56)

* Add configuration for custom prompt label/placeholder

---------

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant