Skip to content

chore: bridged and proxied routes format is inconsistent #162

@pawbana

Description

@pawbana

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.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions