janhq/jan · error · Error

Models endpoint not found for ${provider.provider}. Check th

Error message

Models endpoint not found for ${provider.provider}. Check the base URL configuration.

What it means

Thrown by TauriProviderService.fetchModelsFromProvider (providers/tauri.ts:213) when the GET ${base_url}/models request returns 404. The provider's base URL is reachable and auth passed, but no /models route exists at that path — almost always a base_url misconfiguration where the user included or omitted a path segment.

Source

Thrown at web-app/src/services/providers/tauri.ts:213

          [401, 403, 429].includes(response.status) &&
          ki < keyAttempts.length - 1
        ) {
          continue
        }

        if (!response.ok) {
          if (response.status === 401) {
            throw new Error(
              `Authentication failed: API key is required or invalid for ${provider.provider}`
            )
          }
          if (response.status === 403) {
            throw new Error(
              `Access forbidden: Check your API key permissions for ${provider.provider}`
            )
          }
          if (response.status === 404) {
            throw new Error(
              `Models endpoint not found for ${provider.provider}. Check the base URL configuration.`
            )
          }
          throw new Error(
            `Failed to fetch models from ${provider.provider}: ${response.status} ${response.statusText}`
          )
        }

        const data = await response.json()

        if (data.data && Array.isArray(data.data)) {
          return data.data
            .map((model: { id: string }) => model.id)
            .filter(Boolean)
        }
        if (Array.isArray(data)) {
          return data
            .filter(Boolean)

View on GitHub (pinned to fad3f12a14)

Solutions

  1. Set base_url to the versioned API root the provider documents, with no trailing slash (commonly https://api.openai.com/v1, https://api.anthropic.com, etc.). The code appends /models itself.
  2. Ensure base_url does NOT already end with /models — that causes a double /models/models path.
  3. Confirm the OpenAI-compatible server actually implements GET /models; some self-hosted servers do not.
  4. Check the provider's API docs for the exact base path and version.

Example fix

// before
if (response.status === 404) {
  throw new Error(`Models endpoint not found for ${provider.provider}. Check the base URL configuration.`)
}
// after: also normalize the URL before the request so /models is never doubled
const root = provider.base_url.replace(/\/models\/?$/, '').replace(/\/$/, '')
const response = await fetchTauri(`${root}/models`, ...)
if (response.status === 404) {
  throw new Error(`Models endpoint not found at ${root}/models. Verify the base URL (no trailing /models).`)
}
Defensive patterns

Strategy: validation

Validate before calling

function normalizeProviderBaseUrl(raw: string): string {
  // strip a user-supplied /models suffix and trailing slash; the code appends /models
  return raw.replace(/\/models\/?$/, '').replace(/\/$/, '')
}
// before fetchModelsFromProvider:
if (provider.base_url) provider.base_url = normalizeProviderBaseUrl(provider.base_url)

Type guard

function isLikelyValidBaseUrl(u: string): boolean {
  try { const x = new URL(u); return Boolean(x) && !u.endsWith('/models') }
  catch { return false }
}

Try / catch

try {
  return await providerService.fetchModelsFromProvider(provider)
} catch (e) {
  if (e instanceof Error && /Models endpoint not found/.test(e.message)) {
    toast.error(`No /models at ${provider.base_url}. Set the base URL to the versioned API root (e.g. .../v1).`)
    return []
  }
  throw e
}

Prevention

When it happens

Trigger: base_url is set to the API root (e.g. https://api.provider.com) but the code appends /models while the real path is /v1/models; or base_url already includes /v1/models and the code appends /models again yielding /v1/models/models (404); or the provider uses a non-standard models path.

Common situations: User copied the wrong URL from provider docs (the chat endpoint instead of the base); trailing slash or trailing /v1 inconsistency; provider renamed their API version; custom OpenAI-compatible server that does not implement /models.

Related errors


AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12). Data as JSON: /api/errors/5b7f1fb7a96e3ac8. Report an issue: GitHub.