summaryrefslogtreecommitdiff
path: root/internal/llm/openai.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-19 09:05:29 +0200
committerPaul Buetow <paul@buetow.org>2026-03-19 09:05:29 +0200
commit0918aad469ac2ff5513a7131661f1106e5ec851c (patch)
tree90ecf1245c1d98ec5e3c8ead77978206f2e61155 /internal/llm/openai.go
parent31394385e72dd3a317585838ed1696076043cc60 (diff)
Improve actionable error guidance
Diffstat (limited to 'internal/llm/openai.go')
-rw-r--r--internal/llm/openai.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/llm/openai.go b/internal/llm/openai.go
index d2eff05..eccd558 100644
--- a/internal/llm/openai.go
+++ b/internal/llm/openai.go
@@ -78,7 +78,7 @@ func init() {
func openAIProviderFactory(cfg Config, keys ProviderKeys) (Client, error) {
if strings.TrimSpace(keys.OpenAIAPIKey) == "" {
- return nil, errors.New("missing OPENAI_API_KEY for provider openai")
+ return nil, missingAPIKeyError("openai", "OPENAI_API_KEY", "HEXAI_OPENAI_API_KEY")
}
return newOpenAIWithTimeout(
cfg.OpenAIBaseURL,
@@ -134,7 +134,7 @@ func newOpenAIWithTimeout(baseURL, model, apiKey string, defaultTemp *float64, t
func (c openAIClient) Chat(ctx context.Context, messages []Message, opts ...RequestOption) (string, error) {
if c.apiKey == "" {
- return nilStringErr("missing OpenAI API key")
+ return "", missingAPIKeyError("openai", "OPENAI_API_KEY", "HEXAI_OPENAI_API_KEY")
}
o := Options{Model: c.defaultModel}
for _, opt := range opts {
@@ -189,7 +189,7 @@ func (c openAIClient) DefaultModel() string { return c.defaultModel }
func (c openAIClient) ChatStream(ctx context.Context, messages []Message, onDelta func(string), opts ...RequestOption) error {
if c.apiKey == "" {
- return errors.New("missing OpenAI API key")
+ return missingAPIKeyError("openai", "OPENAI_API_KEY", "HEXAI_OPENAI_API_KEY")
}
o := Options{Model: c.defaultModel}
for _, opt := range opts {