> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Find download sources for model filenames

> Resolves bare model filenames — the strings a ComfyUI workflow node carries, e.g. "flux1-dev-Q8_0.gguf" — into the places they can be downloaded from. A filename our model catalog lists with a HuggingFace link gets that link first, with its folder; HuggingFace and CivitAI are then searched live for the rest of the shortlist. Each candidate carries the fields of a definition's models[] entry (sourceUri, type, filename, sha256), so the create/edit flow can offer a model without the user hunting for a link. A candidate omits type when no model directory is known for it; the caller then picks one from GET /v1/model-directories, since a check or a cut refuses a model with no type.

Candidates are ranked, never applied: a filename is a weak key, so the answer is a shortlist with its confidence attached and the caller picks. A filename that resolves to nothing returns an empty candidates array, not an error — plenty of models are private, renamed, or user-trained. Nothing is cached; every call queries the providers.




## OpenAPI

````yaml /openapi-builder.yaml post /v1/models/resolve
openapi: 3.0.3
info:
  title: Comfy Builder API
  version: 0.1.0
  description: >
    Builder owns builds (editable environment definitions) and cuts immutable,
    deployable releases that Deploy later runs.
servers:
  - url: https://platformapi.comfy.org/builder
    description: Comfy Developer Platform
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /v1/models/resolve:
    post:
      summary: Find download sources for model filenames
      description: >
        Resolves bare model filenames — the strings a ComfyUI workflow node
        carries, e.g. "flux1-dev-Q8_0.gguf" — into the places they can be
        downloaded from. A filename our model catalog lists with a HuggingFace
        link gets that link first, with its folder; HuggingFace and CivitAI are
        then searched live for the rest of the shortlist. Each candidate carries
        the fields of a definition's models[] entry (sourceUri, type, filename,
        sha256), so the create/edit flow can offer a model without the user
        hunting for a link. A candidate omits type when no model directory is
        known for it; the caller then picks one from GET /v1/model-directories,
        since a check or a cut refuses a model with no type.


        Candidates are ranked, never applied: a filename is a weak key, so the
        answer is a shortlist with its confidence attached and the caller picks.
        A filename that resolves to nothing returns an empty candidates array,
        not an error — plenty of models are private, renamed, or user-trained.
        Nothing is cached; every call queries the providers.
      operationId: resolveModelSources
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelResolveRequest'
      responses:
        '200':
          description: >
            Resolution ran. One result per requested filename, in request order;
            a result with no candidates means nothing was found, which is a
            normal outcome. A filename that could not be looked up, including a
            malformed one, carries error instead of failing the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelResolveResult'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    ModelResolveRequest:
      type: object
      required:
        - filenames
      properties:
        filenames:
          type: array
          description: >
            Bare model filenames to resolve. Each must be a plain filename (no
            path separators) made of the same characters a definition's model
            filename allows; anything else is not looked up and comes back with
            error set in its result, since the value would become a provider
            query. A 400 is only for an empty list or more than 32 names.
          minItems: 1
          maxItems: 32
          items:
            type: string
    ModelResolveResult:
      type: object
      required:
        - results
      properties:
        results:
          type: array
          maxItems: 32
          description: One entry per requested filename, in request order.
          items:
            $ref: '#/components/schemas/ModelResolution'
    ModelResolution:
      type: object
      description: What was found for a single requested filename.
      required:
        - filename
        - candidates
      properties:
        filename:
          type: string
          description: The requested filename, echoed back so results can be matched up.
        candidates:
          type: array
          maxItems: 5
          description: >
            Download sources, best first, capped at five. Empty when nothing was
            found. A candidate at or above confidence 0.5 is safe to offer as a
            default selection; below that a human should look before applying.
          items:
            $ref: '#/components/schemas/ModelSourceCandidate'
        error:
          type: string
          description: >
            Set only when this filename could not be looked up at all (both
            providers failed, or the name was rejected). Distinct from an empty
            candidates array, which means the lookup ran and found nothing.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable detail.
    ModelSourceCandidate:
      type: object
      description: >
        One place a model can be downloaded from. The field names mirror a
        definition's models[] entry. type is absent when no model directory is
        known, and a chosen candidate needs one before a check or a cut accepts
        it.
      required:
        - sourceUri
        - filename
        - source
        - confidence
        - verified
      properties:
        sourceUri:
          type: string
          description: Direct https download URL, ready to use as a model's sourceUri.
        type:
          type: string
          description: >
            The ComfyUI model directory this file belongs in, always a member of
            the /v1/model-directories list. Omitted when neither provider gave a
            confident signal — the caller must then pick the directory.
        filename:
          type: string
          description: >
            The on-disk filename as the provider publishes it, which may differ
            in case from the requested name.
        sha256:
          type: string
          description: >
            The file's SHA-256, when the provider states one. Omitted rather
            than guessed: this is an integrity claim a build enforces.
        sizeBytes:
          type: integer
          format: int64
          description: File size in bytes, when known.
        source:
          type: string
          description: Which provider answered.
          enum:
            - huggingface
            - civitai
        repo:
          type: string
          description: >
            The containing repository or model, for a human to sanity-check
            provenance (e.g. "city96/FLUX.1-dev-gguf").
        confidence:
          type: number
          format: double
          description: >
            0..1. Dominated by how exactly the filename matched; a verified URL,
            a known directory, and provider popularity adjust it from there. A
            link from our own model catalog that HuggingFace confirmed serves
            the file scores 1 and comes first.
          minimum: 0
          maximum: 1
        verified:
          type: boolean
          description: >
            A HEAD against sourceUri succeeded, so the URL serves this file now.
            False can mean the check failed for access reasons (a gated repo
            answers 401), so it is not evidence the file is missing.
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        A workspace-scoped Cloud JWT. A missing or invalid token is 401
        UNAUTHORIZED in the Error body.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >
        A workspace API key, sent alone. The service checks it on every request
        and acts as the key's user in the key's workspace. A request carrying a
        key and a Bearer token is 400 INVALID_REQUEST, and a value that is not a
        key's shape is 401 UNAUTHORIZED. A refused key answers 401
        (UNAUTHORIZED), 403 (FORBIDDEN), 404 (NOT_FOUND) or 429 (RATE_LIMITED)
        with its message and Retry-After; a 503 (SERVICE_UNAVAILABLE) means the
        key could not be checked right now, so retry. Each refusal answers the
        Error body.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.