@@ -69,7 +69,10 @@ var BaseURL = sync.OnceValue(func() string {
69 return cmp.Or(os.Getenv("HYPER_URL"), defaultBaseURL)
69 return cmp.Or(os.Getenv("HYPER_URL"), defaultBaseURL)
72−var ErrNoCredits = errors.New("you're out of credits")
73+ ErrNoCredits = errors.New("you're out of credits")
74+ ErrUnauthorized = errors.New("unauthorized")
74type options struct {
77type options struct {
75 baseURL string
78 baseURL string
@@ -183,7 +186,7 @@ func (m *languageModel) Stream(ctx context.Context, call fantasy.Call) (fantasy.
183 return nil, toProviderError(resp, retryAfter(resp))
186 return nil, toProviderError(resp, retryAfter(resp))
184 case http.StatusUnauthorized:
187 case http.StatusUnauthorized:
185 _ = resp.Body.Close()
188 _ = resp.Body.Close()
186− return nil, toProviderError(resp, "")
189+ return nil, ErrUnauthorized
187 case http.StatusPaymentRequired:
190 case http.StatusPaymentRequired:
188 _ = resp.Body.Close()
191 _ = resp.Body.Close()
189 return nil, ErrNoCredits
192 return nil, ErrNoCredits