---
title: "Fetch models from a custom OpenAI-compatible provider"
method: POST
path: "/v1/inference-providers/custom/discover-models"
tags: ["Inference Providers"]
---

# Fetch models from a custom OpenAI-compatible provider

`POST /v1/inference-providers/custom/discover-models`

## Request

- Base URL: `https://api.openworklabs.com`
- URL: `https://api.openworklabs.com/v1/inference-providers/custom/discover-models`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

Calls GET {baseUrl}/models on an OpenAI-compatible provider with its API key (or, with inferenceProviderId, the saved key of that custom provider, only for its saved address's origin) and returns each model with suggested models.dev-style settings, matched against the models.dev OpenRouter catalog. status is detailed (OpenRouter-style entries), basic (ids only) or unavailable (with a reason). The address must be public HTTPS or approved by the operator. 10-second timeout, 5 MB and 500 models at most. Nothing is stored. Requires the Manage Gateway providers permission and enabled Gateway management; a person must send it, never the agent or an API key. Limited to 20 per member and 60 per organization every ten minutes.

## Request body

- union
  - object
    - `baseUrl` string, required
    - `apiKey` string, required
  - object
    - `inferenceProviderId` string, required
    - `baseUrl` string

## Response `200`

Fetch models from a custom OpenAI-compatible provider

- GatewayCustomDiscoverResponse
  - `status` 'detailed' | 'basic' | 'unavailable', required
  - `baseUrl` string, required
  - `reason` string, nullable, required
  - `upstreamStatus` integer, nullable, required
  - `models` object[], required
    - `id` string, required
    - `model` object, nullable, required
      - `id` string, required
      - `name` string
      - `attachment` boolean, required
      - `reasoning` boolean, required
      - `reasoning_options` union[]
        - union
          - object
            - `type` 'toggle', required
          - object
            - `type` 'effort', required
            - `values` string[], required
      - `tool_call` boolean, required
      - `structured_output` boolean, required
      - `temperature` boolean, required
      - `modalities` object, required
        - `input` string[], required
        - `output` string[], required
      - `limit` object, required
        - `context` integer, required
        - `output` integer, required
      - `cost` object
        - `input` number
        - `output` number
        - `cache_read` number
        - `cache_write` number
    - `match` object, nullable, required
      - `providerId` 'openrouter', required
      - `modelId` string, required
      - `by` 'id' | 'canonical_slug' | 'suffix' | 'loose', required

## Other responses

- `400`: Invalid request or provider configuration.
- `401`: Sign-in required.
- `403`: Access denied or Gateway management disabled.
- `404`: Resource not found.
- `409`: Selection or resource conflict.
- `429`: Too many requests. Try again later.

## Changes

- **2026-11-12** `df9bc92e2753`: 1 breaking, 3 info
  - the response's body type changed from no type to `object` for status `404`
  - removed `#/components/schemas/NotFoundError, subschema #2` from the response body `anyOf` list for the response status `404`
  - added the optional property `message` to the response with the `404` status
  - added the required property `error` to the response with the `404` status
- **2026-11-06** `133d32d0939a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/openworklabs/apis/den-api/changes/v1/inference-providers/custom/discover-models/post.md)

---

[API](https://skmtc.dev/openworklabs/apis/den-api.md) - [All operations](https://skmtc.dev/openworklabs/apis/den-api/llms.txt) - [OpenAPI document](https://skmtc.dev/openworklabs/apis/den-api/revisions/84fb0f99fb95?raw)
