In every provider bridged routes contain provider prefix while proxied routes don't.
Example:
- bridged routes for OpenAI provider:
|
routeChatCompletions = "/openai/v1/chat/completions" // https://platform.openai.com/docs/api-reference/chat |
|
routeResponses = "/openai/v1/responses" // https://platform.openai.com/docs/api-reference/responses |
- pass through routes for OpenAI provider:
|
func (p *OpenAI) PassthroughRoutes() []string { |
|
return []string{ |
|
// See https://pkg.go.dev/net/http#hdr-Trailing_slash_redirection-ServeMux. |
|
// but without non trailing slash route requests to `/v1/conversations` are going to catch all |
|
"/v1/conversations", |
|
"/v1/conversations/", |
|
"/v1/models", |
|
"/v1/models/", |
|
"/v1/responses/", // Forwards other responses API endpoints, eg: https://platform.openai.com/docs/api-reference/responses/get |
|
} |
|
} |
Format should be the same between bridged and pass through routes.
Additional pedantic not important remark that may introduce backwards compatibility issues: v1 prefix for OpenAI paths is not necessary. Docs mention setting OPENAI_BASE_URL to https://coder.example.com/api/v2/aibridge/openai/v1 which includes the v1 suffix so removing it would be problematic but there is no need for it to exist. It may cause confusion why it is there.
In every provider bridged routes contain provider prefix while proxied routes don't.
Example:
aibridge/provider/openai.go
Lines 21 to 22 in 406f98f
aibridge/provider/openai.go
Lines 72 to 82 in 406f98f
Format should be the same between bridged and pass through routes.
Additional pedantic not important remark that may introduce backwards compatibility issues: v1 prefix for OpenAI paths is not necessary. Docs mention setting
OPENAI_BASE_URLtohttps://coder.example.com/api/v2/aibridge/openai/v1which includes thev1suffix so removing it would be problematic but there is no need for it to exist. It may cause confusion why it is there.