Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ type API struct {
APIKey string `yaml:"api-key"`
APIKeyEnv string `yaml:"api-key-env"`
APIKeyCmd string `yaml:"api-key-cmd"`
Version string `yaml:"version"` // XXX: not used anywhere
Version string `yaml:"version"` // Used by azure-ad
BaseURL string `yaml:"base-url"`
Models map[string]Model `yaml:"models"`
User string `yaml:"user"`
Expand Down
11 changes: 10 additions & 1 deletion internal/openai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ type Config struct {
Do(*http.Request) (*http.Response, error)
}
APIType string
Version string
}

// getVersion returns the API version to be used for azure-ad.
func (c Config) getVersion() string {
if c.Version != "" {
return c.Version
}
return "v1"
}

// DefaultConfig returns the default configuration for the OpenAI API client.
Expand All @@ -50,7 +59,7 @@ func New(config Config) *Client {
if config.APIType == "azure-ad" {
opts = append(opts, azure.WithAPIKey(config.AuthToken))
if config.BaseURL != "" {
opts = append(opts, azure.WithEndpoint(config.BaseURL, "v1"))
opts = append(opts, azure.WithEndpoint(config.BaseURL, config.getVersion()))
}
} else {
opts = append(opts, option.WithAPIKey(config.AuthToken))
Expand Down
1 change: 1 addition & 0 deletions mods.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ func (m *Mods) startCompletionCmd(content string) tea.Cmd {
}
if mod.API == "azure-ad" {
ccfg.APIType = "azure-ad"
ccfg.Version = api.Version
}
if api.User != "" {
cfg.User = api.User
Expand Down