Skip to content

feat: support custom headers in customai resource type#8364

Draft
centdix wants to merge 2 commits intomainfrom
add-customai-headers
Draft

feat: support custom headers in customai resource type#8364
centdix wants to merge 2 commits intomainfrom
add-customai-headers

Conversation

@centdix
Copy link
Collaborator

@centdix centdix commented Mar 13, 2026

Summary

Allow users to add custom HTTP headers to the customai resource type. When the hub updates the resource type to include a headers field (a JSON object mapping header names to values), those headers will be sent on every AI request for that resource.

Changes

  • Add headers: HashMap<String, String> field (with #[serde(default)]) to AIStandardResource and ProviderResource structs
  • Thread custom headers through AIRequestConfig and apply them in the API proxy's prepare_request()
  • Apply resource custom headers in the worker's build_http_request closure for AI agent execution

Test plan

  • Verify existing AI resources without a headers field still work (backwards-compatible via #[serde(default)])
  • Create a customai resource with "headers": {"X-Custom": "test"} and verify the header is sent on AI requests
  • Confirm custom headers from the resource are applied after env-var AI_HTTP_HEADERS (resource headers take precedence)

Generated with Claude Code

centdix and others added 2 commits March 13, 2026 12:10
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8a96dd7
Status: ✅  Deploy successful!
Preview URL: https://0cbe65ca.windmill.pages.dev
Branch Preview URL: https://add-customai-headers.windmill.pages.dev

View logs

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