Skip to content

fix: append /chat/completions for prefixed v1 base URLs#8521

Open
aravind4219 wants to merge 3 commits intoaaif-goose:mainfrom
aravind4219:main
Open

fix: append /chat/completions for prefixed v1 base URLs#8521
aravind4219 wants to merge 3 commits intoaaif-goose:mainfrom
aravind4219:main

Conversation

@aravind4219
Copy link
Copy Markdown

Summary

Fixed a bug where custom OpenAI-compatible providers with a prefixed base_url like https://opencode.ai/zen/go/v1 would fail with a 404 because goose was hitting …/zen/go/v1 directly instead of …/zen/go/v1/chat/completions.

The path detection logic in from_custom_config knew to append /chat/completions when the URL path was exactly /v1, but didn't handle the case where /v1 came after a custom prefix. One line of logic, but easy to miss when you're configuring a provider that doesn't follow the standard api.example.com/v1 pattern.

Testing

Added 7 unit tests for the new derive_base_path helper covering the broken case and making sure existing patterns (bare /v1, already-full endpoint paths, non-v1 custom paths) still work correctly. All existing tests pass.

Related Issues

Relates to #ISSUE_ID : 8517
Discussion: LINK (if any): #8517

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