Skip to content

Fix: Remove Hardcoded /v1 From OpenAI Provider URL Path#16

Merged
jrswab merged 1 commit intomasterfrom
update-openai-base-url
Mar 6, 2026
Merged

Fix: Remove Hardcoded /v1 From OpenAI Provider URL Path#16
jrswab merged 1 commit intomasterfrom
update-openai-base-url

Conversation

@jrswab
Copy link
Owner

@jrswab jrswab commented Mar 6, 2026

Summary

This fix removes the hardcoded "/v1" path segment from OpenAI provider URL construction, moving it into the default base URL instead. This prevents automatic injection of "/v1" into custom base URLs, allowing proxies and gateways with their own version prefixes to work correctly without encountering 404 errors.

Changelog

Fixed

  • Remove hardcoded /v1 from OpenAI provider URL path by moving it into the default base URL
  • Prevent automatic injection of /v1 into custom base URLs to avoid routing failures through proxies and gateways with version prefixes

Changed

  • Default OpenAI base URL updated from https://api.openai.com to https://api.openai.com/v1
  • OpenAI request path construction updated to use baseURL + "/chat/completions" instead of baseURL + "/v1/chat/completions"
  • Integration test expectations updated to assert path as "/chat/completions" instead of "/v1/chat/completions"
  • Unit test expectations updated to reflect new path behavior
  • .gitignore pattern broadened from axe to axe* for more flexible file matching

Added

  • New test case TestOpenAI_Send_CustomBaseURL_NoV1Prefix to verify that custom base URLs (e.g., endpoints with /ai/v2) are not modified with additional /v1 prefixes

Entire-Checkpoint: e3e6eed9ea99

Move /v1 into the default base URL instead of appending it in Send().
Custom base URLs (e.g. Gloo's /ai/v2 endpoint) no longer get /v1
injected, which caused 404 errors when routing through proxies
that use their own version prefix.

Entire-Checkpoint: e3e6eed9ea99
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3af2a07e-5b6d-4379-a393-a057266a9c10

📥 Commits

Reviewing files that changed from the base of the PR and between 963dd2e and 2bc8a44.

📒 Files selected for processing (4)
  • .gitignore
  • cmd/run_integration_test.go
  • internal/provider/openai.go
  • internal/provider/openai_test.go

📝 Walkthrough

Walkthrough

The OpenAI provider's default base URL is updated from https://api.openai.com to https://api.openai.com/v1, shifting version prefix responsibility from the request path to the base URL. Correspondingly, request paths change from /v1/chat/completions to /chat/completions. Tests and .gitignore are updated accordingly.

Changes

Cohort / File(s) Summary
Configuration
.gitignore
Broadened the pattern for ignoring files named "axe" from exact match to prefix-based match (axe*).
OpenAI Provider
internal/provider/openai.go
Updated default base URL to include /v1 suffix with explanatory comment; removed /v1 prefix from chat completions endpoint path construction.
Test Files
cmd/run_integration_test.go, internal/provider/openai_test.go
Updated existing test expectations to reflect new request path format (/chat/completions); added new test TestOpenAI_Send_CustomBaseURL_NoV1Prefix to verify custom base URLs are not modified with injected /v1 prefixes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🔗 URLs once scattered with /v1 scattered wide,
Now bundled in the base, where versions reside.
Tests follow suit with paths clean and neat,
Custom bases dance free—no /v1 deceit!
API harmony—at last, what a treat. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix: Remove Hardcoded /v1 From OpenAI Provider URL Path' accurately reflects the main change—moving the hardcoded /v1 from the request path construction into the default base URL to support custom base URLs without 404 errors.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-openai-base-url

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jrswab jrswab merged commit beba262 into master Mar 6, 2026
4 checks passed
@jrswab jrswab deleted the update-openai-base-url branch March 6, 2026 23:27
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