Skip to content

Conversation

@AyushSawant18588
Copy link
Contributor

@AyushSawant18588 AyushSawant18588 commented Nov 7, 2025

Description
Introduces configurable provider endpoint prefixes via global configurations.

Compatibility
Non-breaking: defaults preserve current behavior for OpenAI (/), Cohere (/cohere), Anthropic (/anthropic) if not set.

Related Issues/PRs (if applicable)
#1457

Signed-off-by: ayush <ayush.sawant@nutanix.com>
@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.98%. Comparing base (ad5f75e) to head (1a6240b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1514      +/-   ##
==========================================
+ Coverage   83.92%   83.98%   +0.05%     
==========================================
  Files         144      144              
  Lines       12668    12705      +37     
==========================================
+ Hits        10632    10670      +38     
+ Misses       1421     1419       -2     
- Partials      615      616       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AyushSawant18588 AyushSawant18588 marked this pull request as ready for review November 7, 2025 11:55
@AyushSawant18588 AyushSawant18588 requested a review from a team as a code owner November 7, 2025 11:55
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 7, 2025
Signed-off-by: ayush <ayush.sawant@nutanix.com>
@AyushSawant18588 AyushSawant18588 changed the title feat: make prefix of endpoints configurable [WIP] feat: make prefix of endpoints configurable Nov 7, 2025
@AyushSawant18588 AyushSawant18588 changed the title [WIP] feat: make prefix of endpoints configurable feat: make prefix of endpoints configurable Nov 7, 2025
Signed-off-by: ayush <ayush.sawant@nutanix.com>
Signed-off-by: ayush <ayush.sawant@nutanix.com>
@siddharth1036
Copy link
Contributor

@AyushSawant18588 can you check if e2e tests are required with custom prefixes?

Comment on lines 17 to 20
# Comma-separated key-value pairs for endpoint prefixes.
# Format: "openaiPrefix:/prefix1,anthropicPrefix:/prefix2"
# Example: "openaiPrefix:/,coherePrefix:/cohere,anthropicPrefix:/anthropic"
endpointPrefixes: ""
Copy link
Member

Choose a reason for hiding this comment

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

i would rather have an explicit exhaustive list here to avoid manual validation at runtime

Suggested change
# Comma-separated key-value pairs for endpoint prefixes.
# Format: "openaiPrefix:/prefix1,anthropicPrefix:/prefix2"
# Example: "openaiPrefix:/,coherePrefix:/cohere,anthropicPrefix:/anthropic"
endpointPrefixes: ""
openai: ""
anthropic: "/anthropic"
cohere: "/cohere"

Copy link
Member

Choose a reason for hiding this comment

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

also could you add detailed comments here by showing exact paths examples. At least one for each provider

Copy link
Contributor Author

@AyushSawant18588 AyushSawant18588 Nov 7, 2025

Choose a reason for hiding this comment

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

The idea behind using key-value pairs for endpoint prefixes was to make the design more scalable. As we add support for more providers in the future, maintaining an explicit list would require updating multiple files (helm values, controller deployment, controller, extproc, gateway_mutator, internalapi, etc.) each time. With the current approach, any new provider addition would only require changes within the EndpointPrefixes struct and related functions in the internalapi package.
What are your thoughts on this trade-off?

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer my suggestion for now, not trying to solve non existing problem

Copy link
Member

Choose a reason for hiding this comment

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

btw you can concatenate strings in helm functions so your concern on multiple changes doesn't apply here i believe

Copy link
Member

Choose a reason for hiding this comment

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

my suggestion is "let's not expose the error prone string format to users". I am not saying we shouldn't use the concatenated ones in arguments in extproc/controller, it should be totally fine

Copy link
Contributor Author

@AyushSawant18588 AyushSawant18588 Nov 7, 2025

Choose a reason for hiding this comment

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

Oh thanks, got your point so expose explicit prefixes via values but concatenate and pass it as a string in endpointPrefixes arg to controller. So this structure is fine for string after concatenation right?

--endpointPrefixes='endpointConfig.endpointPrefixes=openaiPrefix:/,coherePrefix:/cohere,anthropicPrefix:/anthropic'

Copy link
Member

Choose a reason for hiding this comment

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

yes

@mathetake
Copy link
Member

For e2e you can reuse the existing e2e-namespaced for non default config https://github.com/envoyproxy/ai-gateway/tree/main/tests/e2e-namespaced @AyushSawant18588

@AyushSawant18588
Copy link
Contributor Author

For e2e you can reuse the existing e2e-namespaced for non default config https://github.com/envoyproxy/ai-gateway/tree/main/tests/e2e-namespaced @AyushSawant18588

can you tell what e2e test are you suggesting to add?

@mathetake
Copy link
Member

i would say pass your new helm value with non-default prefix for openai in the e2e setup, and then access the gateway

Signed-off-by: ayush <ayush.sawant@nutanix.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants