Skip to content

fix(openai,openaicompat): apply WithName to provider lookup and Name()#212

Merged
andreynering merged 1 commit intocharmbracelet:mainfrom
fwang2002:provider-name-fix
Apr 29, 2026
Merged

fix(openai,openaicompat): apply WithName to provider lookup and Name()#212
andreynering merged 1 commit intocharmbracelet:mainfrom
fwang2002:provider-name-fix

Conversation

@fwang2002
Copy link
Copy Markdown
Contributor

@fwang2002 fwang2002 commented Apr 25, 2026

The openaicompat PrepareCallFunc looked up ProviderOptions using the hardcoded "openai-compat" key, so any name supplied via WithName was silently ignored — users could not key their per-call options under a custom provider name. Switch the lookup to model.Provider() so it matches whatever name was configured.

Similarly, the openai provider's Name() method always returned the hardcoded "openai" constant, discarding the value passed to WithName. Return o.options.name instead so the configured name is reported consistently.

Fixes: #210

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features).

The openaicompat PrepareCallFunc looked up ProviderOptions using the
hardcoded "openai-compat" key, so any name supplied via WithName was
silently ignored — users could not key their per-call options under a
custom provider name. Switch the lookup to model.Provider() so it
matches whatever name was configured.

Similarly, the openai provider's Name() method always returned the
hardcoded "openai" constant, discarding the value passed to WithName.
Return o.options.name instead so the configured name is reported
consistently.
Copy link
Copy Markdown
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@andreynering andreynering merged commit b2f7230 into charmbracelet:main Apr 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provider name should not hard coded for openaicompat

3 participants