{
  "openapi": "3.1.0",
  "info": {
    "title": "Ollama Library API",
    "version": "1.3.0",
    "description": "Unofficial JSON API for every model in the Ollama library (https://ollama.com/library?sort=newest), and community models (user/model) from ollama.com search. Refreshed hourly. No key, CORS open."
  },
  "servers": [
    {
      "url": "https://ollama.kinduff.com"
    }
  ],
  "security": [],
  "paths": {
    "/api/models": {
      "get": {
        "summary": "List models, newest first",
        "operationId": "listModels",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "description": "library (default): the official library. community: community models (user/model). With q, from ollama.com search, 20 a page; official matches are left out and come first on ollama.com, so early pages of a broad q can be empty while has_more is true. Without q, every community model this API has seen, newest first, 100 a page.",
            "schema": {
              "type": "string",
              "enum": [
                "library",
                "community"
              ],
              "default": "library"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Search name and description (case-insensitive).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page of results: 20 at most from ollama.com search, 100 from the models seen. Only with source=community.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "capability",
            "in": "query",
            "description": "Filter by capability, e.g. tools, vision, thinking, embedding.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cloud",
            "in": "query",
            "description": "true for cloud models only, false for local only.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Model list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Library"
                }
              }
            }
          },
          "400": {
            "description": "Unknown source",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream fetch or parse failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/models/{name}": {
      "get": {
        "summary": "Get one model by name, with every tag",
        "description": "name is an official model (d3) or a community model with its user (MedAIBase/Qwen3-VL-Embedding). A community model is read from ollama.com at most hourly; when that fails, a model seen before is served with stale and refresh_error.",
        "operationId": "getModel",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "d3"
          }
        ],
        "responses": {
          "200": {
            "description": "Model",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDetail"
                }
              }
            }
          },
          "404": {
            "description": "Model not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Upstream fetch or parse failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Library": {
        "type": "object",
        "required": [
          "source",
          "fetched_at",
          "stale",
          "count",
          "models"
        ],
        "properties": {
          "source": {
            "type": "string",
            "format": "uri"
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the list was read from ollama.com."
          },
          "stale": {
            "type": "boolean",
            "description": "True when ollama.com could not be read and the last list read is served instead."
          },
          "refresh_error": {
            "type": "string",
            "description": "Why the last read failed. Only when stale.",
            "example": "upstream 503"
          },
          "count": {
            "type": "integer"
          },
          "page": {
            "type": "integer",
            "description": "Only with source=community."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether another page follows. Only with source=community."
          },
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        }
      },
      "Model": {
        "type": "object",
        "required": [
          "name",
          "url",
          "description",
          "capabilities",
          "sizes",
          "cloud"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "As used with ollama pull: user/model for community models.",
            "example": "d3"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "vision",
              "decision"
            ]
          },
          "sizes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "2b",
              "4b",
              "9b",
              "27b"
            ]
          },
          "cloud": {
            "type": "boolean"
          },
          "pulls": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Approximate; parsed from labels like 40K."
          },
          "pulls_label": {
            "type": [
              "string",
              "null"
            ],
            "example": "2,905"
          },
          "tags": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Null when ollama.com shows no tag count."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Date only (midnight UTC) in community search results."
          },
          "updated_label": {
            "type": [
              "string",
              "null"
            ],
            "example": "yesterday"
          },
          "size_bytes": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Download in bytes of each size and latest, from the model's tags page. Null until read; empty for cloud-only models and models with only variant tags.",
            "example": {
              "latest": 5600000000,
              "4b": 5600000000
            }
          }
        }
      },
      "ModelDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Model"
          },
          {
            "type": "object",
            "properties": {
              "tag_details": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/Tag"
                },
                "description": "Every tag on the model's tags page. Null until read."
              },
              "tags_fetched_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "stale": {
                "type": "boolean",
                "description": "Community models only, and only when ollama.com could not be read and the model as last read is served."
              },
              "refresh_error": {
                "type": "string",
                "description": "Why the read failed. Only when stale."
              }
            }
          }
        ]
      },
      "Tag": {
        "type": "object",
        "required": [
          "tag"
        ],
        "properties": {
          "tag": {
            "type": "string",
            "example": "4b"
          },
          "digest": {
            "type": [
              "string",
              "null"
            ],
            "description": "Short digest; tags with the same digest are the same build.",
            "example": "492e37dc6907"
          },
          "size_bytes": {
            "type": [
              "integer",
              "null"
            ],
            "description": "What ollama pull downloads. Null for cloud tags.",
            "example": 3300000000
          },
          "size_bytes_max": {
            "type": [
              "integer",
              "null"
            ],
            "description": "A larger variant (MLX) when ollama.com shows a range, else size_bytes.",
            "example": 4000000000
          },
          "context": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Context window in tokens.",
            "example": 262144
          },
          "input": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "text",
              "image"
            ]
          },
          "cloud": {
            "type": "boolean"
          },
          "updated_label": {
            "type": [
              "string",
              "null"
            ],
            "example": "2 weeks ago"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}