[GH-ISSUE #2022] List available models #47679

Closed
opened 2026-04-28 04:54:10 -05:00 by GiteaMirror · 17 comments
Owner

Originally created by @ParisNeo on GitHub (Jan 16, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2022

Hi. The API allows me to list the local models. Is there a way to list all available models (those we can find in the website of ollama?
I need that for the models zoo to make it easy for users of lollms with ollama backend to install the models.

I prefer this rather than having to scrape the website to get the latest list of models.

Originally created by @ParisNeo on GitHub (Jan 16, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2022 Hi. The API allows me to list the local models. Is there a way to list all available models (those we can find in the website of ollama? I need that for the models zoo to make it easy for users of lollms with ollama backend to install the models. I prefer this rather than having to scrape the website to get the latest list of models.
GiteaMirror added the ollama.comfeature request labels 2026-04-28 04:54:10 -05:00
Author
Owner

@LorenDB commented on GitHub (Jan 17, 2024):

I'll +1 this. I'm building a client that ideally should allow users to choose what models they want in the client rather than copy-pasting model names from the Ollama website.

<!-- gh-comment-id:1894902056 --> @LorenDB commented on GitHub (Jan 17, 2024): I'll +1 this. I'm building a client that ideally should allow users to choose what models they want in the client rather than copy-pasting model names from the Ollama website.
Author
Owner

@hovhannest commented on GitHub (Feb 26, 2024):

Me too, + 1

<!-- gh-comment-id:1963778813 --> @hovhannest commented on GitHub (Feb 26, 2024): Me too, + 1
Author
Owner

@lorenzejay commented on GitHub (Feb 27, 2024):

Same here +1

<!-- gh-comment-id:1967493133 --> @lorenzejay commented on GitHub (Feb 27, 2024): Same here +1
Author
Owner

@liar666 commented on GitHub (Feb 28, 2024):

Same here

<!-- gh-comment-id:1970017841 --> @liar666 commented on GitHub (Feb 28, 2024): Same here
Author
Owner

@vaiju1981 commented on GitHub (Feb 29, 2024):

There is no way to discover what other models that are not part of ollama space ( like users space )

<!-- gh-comment-id:1970136598 --> @vaiju1981 commented on GitHub (Feb 29, 2024): There is no way to discover what other models that are not part of ollama space ( like users space )
Author
Owner

@hovhannest commented on GitHub (Mar 1, 2024):

There is no way to discover what other models that are not part of ollama space ( like users space )

What about a query by a namespace (and defaulted to the ollama)?

<!-- gh-comment-id:1973710169 --> @hovhannest commented on GitHub (Mar 1, 2024): > There is no way to discover what other models that are not part of ollama space ( like users space ) What about a query by a namespace (and defaulted to the ollama)?
Author
Owner

@bitfist commented on GitHub (Jun 2, 2024):

+1

<!-- gh-comment-id:2143983872 --> @bitfist commented on GitHub (Jun 2, 2024): +1
Author
Owner

@Frank995 commented on GitHub (Jun 11, 2024):

+1

<!-- gh-comment-id:2160391910 --> @Frank995 commented on GitHub (Jun 11, 2024): +1
Author
Owner

@paulrobello commented on GitHub (Jul 12, 2024):

+1

<!-- gh-comment-id:2224588934 --> @paulrobello commented on GitHub (Jul 12, 2024): +1
Author
Owner

@ningo247 commented on GitHub (Jul 24, 2024):

+1

<!-- gh-comment-id:2249014106 --> @ningo247 commented on GitHub (Jul 24, 2024): +1
Author
Owner

@carlosalvidrez commented on GitHub (Sep 6, 2024):

+1 This would be awesome

<!-- gh-comment-id:2334476911 --> @carlosalvidrez commented on GitHub (Sep 6, 2024): +1 This would be awesome
Author
Owner

@akamalov commented on GitHub (Sep 9, 2024):

+1

<!-- gh-comment-id:2338444612 --> @akamalov commented on GitHub (Sep 9, 2024): +1
Author
Owner

@webfarmer commented on GitHub (Oct 2, 2024):

Hi. The API allows me to list the local models. Is there a way to list all available models (those we can find in the website of ollama? I need that for the models zoo to make it easy for users of lollms with ollama backend to install the models.

I prefer this rather than having to scrape the website to get the latest list of models.

Suck that you can't do this.

I've created a python script that just does the job, but you need to:

pip install bs4

Git Repo Here

This Python script scrapes information about AI models from the Ollama library website (https://ollama.com/library). It performs the following main tasks:

It first checks if a local HTML file exists. If not, it fetches the webpage content and saves it locally.
It then parses the HTML content using BeautifulSoup to extract details about each model, including name, description, sizes, number of pulls, tags, and last updated date.

The extracted information is printed to the console and also saved as a JSON file.

The script includes error handling for failed web requests and creates necessary directories if they don't exist.

This code allows users to easily obtain and store up-to-date information about available models in the Ollama library without manually browsing the website.

<!-- gh-comment-id:2388056913 --> @webfarmer commented on GitHub (Oct 2, 2024): > Hi. The API allows me to list the local models. Is there a way to list all available models (those we can find in the website of ollama? I need that for the models zoo to make it easy for users of lollms with ollama backend to install the models. > > I prefer this rather than having to scrape the website to get the latest list of models. Suck that you can't do this. I've created a python script that just does the job, but you need to: `pip install bs4` [Git Repo Here](https://github.com/webfarmer/ollama-get-models) This Python script scrapes information about AI models from the Ollama library website (https://ollama.com/library). It performs the following main tasks: It first checks if a local HTML file exists. If not, it fetches the webpage content and saves it locally. It then parses the HTML content using BeautifulSoup to extract details about each model, including name, description, sizes, number of pulls, tags, and last updated date. The extracted information is printed to the console and also saved as a JSON file. The script includes error handling for failed web requests and creates necessary directories if they don't exist. This code allows users to easily obtain and store up-to-date information about available models in the Ollama library without manually browsing the website.
Author
Owner

@carlosalvidrez commented on GitHub (Oct 2, 2024):

Hey, thank you!

<!-- gh-comment-id:2389286534 --> @carlosalvidrez commented on GitHub (Oct 2, 2024): Hey, thank you!
Author
Owner

@rmariboe commented on GitHub (Nov 8, 2024):

I hacked this abomination together - gets the job done 😅

function Get-OllamaModels {
 $ollamaLibUri = 'https://ollama.com/library'
 $ollamaLib = Invoke-WebRequest -Uri $ollamaLibUri
 $modelLinks = $ollamaLib.Links | Where-Object {$_.href.StartsWith('/library/')}

 $ollamaModelWebRequest = {
  $ollamaModelUri = 'https://ollama.com/library/' + $this.Name
  $ollamaModel = Invoke-WebRequest -Uri $ollamaModelUri
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModel -Force -PassThru).ModelWebRequestResponse
 }

 $ollamaModelTagsWebRequest = {
  $ollamaModelTagsUri = 'https://ollama.com/library/' + $this.Name + '/tags'
  $ollamaModelTags = Invoke-WebRequest -Uri $ollamaModelTagsUri
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTags -Force -PassThru).ModelTagsWebRequestResponse
 }
   
 $ollamaModelReadmeFunction = {
  $readmeIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>') + '<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>'.Length
  $readmeTextareaIndexDelimiterStart = '<textarea'
  $readmeTextareaIndexStart = $this.ModelWebRequestResponse.Content.IndexOf($readmeTextareaIndexDelimiterStart, $readmeIndexStart) + $readmeTextareaIndexDelimiterStart.Length
  $readmeTextIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('>', $readmeTextareaIndexStart) + '>'.Length
  $readmeTextareaIndexEnd = $this.ModelWebRequestResponse.Content.IndexOf('</textarea', $readmeTextIndexStart)
  $this.ModelWebRequestResponse.Content.Substring($readmeTextIndexStart, $readmeTextareaIndexEnd - $readmeTextIndexStart).Trim()
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Description' -Value $ollamaModelDescription -Force -PassThru).Description
 }

 $ollamaModelTagsFunction = {
  $ollamaModelTagLinks = $this.ModelTagsWebRequestResponse.Links | Where-Object {$_.class -eq 'group'}
  $ollamaModelTagInfo = @()
  foreach ($ollamaModelTagLink in $ollamaModelTagLinks) {
   $ollamaModelTagName = $ollamaModelTagLink.href.Split('/')[-1]
   $ollamaModelTagInfoStart = $this.ModelTagsWebRequestResponse.Content.IndexOf($ollamaModelTagLink.outerHTML) + $ollamaModelTagLink.outerHTML.Length
   $ollamaModelTagIdEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagInfoStart) + '</span>'.Length
   $ollamaModelTagInfoEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagIdEnd)
   $ollamaModelTagInfoSplit = $this.ModelTagsWebRequestResponse.Content.Substring($ollamaModelTagIdEnd, $ollamaModelTagInfoEnd - $ollamaModelTagIdEnd).Split("`n")
   $ollamaModelTagInfoSizeHumanReadable = $ollamaModelTagInfoSplit[0].Trim().Split(' ')[1]
   try {$ollamaModelTagInfoSize = [int64][scriptblock]::Create($ollamaModelTagInfoSizeHumanReadable).InvokeReturnAsIs()} catch {}
   $ollamaModelTagInfoUpdated = $ollamaModelTagInfoSplit[1].Trim()
   $ollamaModelTagInfo += [pscustomobject]@{
    'Name' = $ollamaModelTagName;
    'Size' = $ollamaModelTagInfoSize;
    'SizeHumanReadable' = $ollamaModelTagInfoSizeHumanReadable;
    'Updated' = $ollamaModelTagInfoUpdated
   }
  }
  return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Tags' -Value $ollamaModelTagInfo -Force -PassThru).Tags
 }

 $modelLinks | ForEach-Object {
  $ollamaModelLinkDescriptionDelimiterStart = '<p class="max-w-lg break-words text-neutral-800 text-md">'
  $ollamaModelLinkDescriptionStart = $_.outerHTML.IndexOf($ollamaModelLinkDescriptionDelimiterStart) + $ollamaModelLinkDescriptionDelimiterStart.Length
  $ollamaModelLinkDescriptionEnd = $_.outerHTML.IndexOf('</p>', $ollamaModelLinkDescriptionStart)
  $ollamaModelLinkDescription = $_.outerHTML.SubString($ollamaModelLinkDescriptionStart, $ollamaModelLinkDescriptionEnd - $ollamaModelLinkDescriptionStart).Trim()

  $ollamaModelLinkPullCountDelimiterStart = '<span x-test-pull-count>'
  $ollamaModelLinkPullCountStart = $_.outerHTML.IndexOf($ollamaModelLinkPullCountDelimiterStart) + $ollamaModelLinkPullCountDelimiterStart.Length
  $ollamaModelLinkPullCountEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkPullCountStart)
  $ollamaModelLinkPullCount = $_.outerHTML.SubString($ollamaModelLinkPullCountStart, $ollamaModelLinkPullCountEnd - $ollamaModelLinkPullCountStart).Trim()

  $ollamaModelLinkUpdatedDelimiterStart = '<span x-test-updated>'
  $ollamaModelLinkUpdatedStart = $_.outerHTML.IndexOf($ollamaModelLinkUpdatedDelimiterStart) + $ollamaModelLinkUpdatedDelimiterStart.Length
  $ollamaModelLinkUpdatedEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkUpdatedStart)
  $ollamaModelLinkUpdated = $_.outerHTML.SubString($ollamaModelLinkUpdatedStart, $ollamaModelLinkUpdatedEnd - $ollamaModelLinkUpdatedStart).Trim()

  $ollamaModelLinkCapabilitiesDelimiterStart = '<span x-test-capability class="inline-flex items-center rounded-md bg-indigo-50 px-2 py-0.5 text-xs font-medium text-indigo-600 sm:text-[13px]">'
  if ($_.outerHTML.Contains($ollamaModelLinkCapabilitiesDelimiterStart)) {
   $ollamaModelLinkCapabilitiesStart = $_.outerHTML.IndexOf($ollamaModelLinkCapabilitiesDelimiterStart) + $ollamaModelLinkCapabilitiesDelimiterStart.Length
   $ollamaModelLinkCapabilitiesEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkCapabilitiesStart)
   $ollamaModelLinkCapabilities = $_.outerHTML.SubString($ollamaModelLinkCapabilitiesStart, $ollamaModelLinkCapabilitiesEnd - $ollamaModelLinkCapabilitiesStart).Trim()
  }

  $ollamaModelLinkSizeDelimiterStart = '<span x-test-size class="inline-flex items-center rounded-md bg-[#ddf4ff] px-2 py-0.5 text-xs font-medium text-blue-600 sm:text-[13px]">'
  if ($_.outerHTML.Contains($ollamaModelLinkSizeDelimiterStart)) {
   $ollamaModelLinkSizeStart = $_.outerHTML.IndexOf($ollamaModelLinkSizeDelimiterStart) + $ollamaModelLinkSizeDelimiterStart.Length
   $ollamaModelLinkSizeEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkSizeStart)
   $ollamaModelLinkSize = $_.outerHTML.SubString($ollamaModelLinkSizeStart, $ollamaModelLinkSizeEnd - $ollamaModelLinkSizeStart).Trim()
  }

  [pscustomobject]@{
   'Name' = $_.href.Split('/')[-1].Trim();
   'Description' = $ollamaModelLinkDescription;
   'PullCount' = $ollamaModelLinkPullCount;
   'Updated' = $ollamaModelLinkUpdated;
   'Capabilities' = $ollamaModelLinkCapabilities;
   'Size' = $ollamaModelLinkSize
  } |
  Add-Member -MemberType 'ScriptProperty' -Name 'Readme' -Value $ollamaModelReadmeFunction -PassThru |
  Add-Member -MemberType 'ScriptProperty' -Name 'Tags' -Value $ollamaModelTagsFunction -PassThru |
  Add-Member -MemberType 'ScriptProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModelWebRequest -PassThru |
  Add-Member -MemberType 'ScriptProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTagsWebRequest -PassThru
 }
}
<!-- gh-comment-id:2465908433 --> @rmariboe commented on GitHub (Nov 8, 2024): I hacked this abomination together - gets the job done 😅 ```powershell function Get-OllamaModels { $ollamaLibUri = 'https://ollama.com/library' $ollamaLib = Invoke-WebRequest -Uri $ollamaLibUri $modelLinks = $ollamaLib.Links | Where-Object {$_.href.StartsWith('/library/')} $ollamaModelWebRequest = { $ollamaModelUri = 'https://ollama.com/library/' + $this.Name $ollamaModel = Invoke-WebRequest -Uri $ollamaModelUri return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModel -Force -PassThru).ModelWebRequestResponse } $ollamaModelTagsWebRequest = { $ollamaModelTagsUri = 'https://ollama.com/library/' + $this.Name + '/tags' $ollamaModelTags = Invoke-WebRequest -Uri $ollamaModelTagsUri return ($this | Add-Member -MemberType 'NoteProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTags -Force -PassThru).ModelTagsWebRequestResponse } $ollamaModelReadmeFunction = { $readmeIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>') + '<h2 class="text-base font-semibold leading-6 text-neutral-900">Readme</h2>'.Length $readmeTextareaIndexDelimiterStart = '<textarea' $readmeTextareaIndexStart = $this.ModelWebRequestResponse.Content.IndexOf($readmeTextareaIndexDelimiterStart, $readmeIndexStart) + $readmeTextareaIndexDelimiterStart.Length $readmeTextIndexStart = $this.ModelWebRequestResponse.Content.IndexOf('>', $readmeTextareaIndexStart) + '>'.Length $readmeTextareaIndexEnd = $this.ModelWebRequestResponse.Content.IndexOf('</textarea', $readmeTextIndexStart) $this.ModelWebRequestResponse.Content.Substring($readmeTextIndexStart, $readmeTextareaIndexEnd - $readmeTextIndexStart).Trim() return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Description' -Value $ollamaModelDescription -Force -PassThru).Description } $ollamaModelTagsFunction = { $ollamaModelTagLinks = $this.ModelTagsWebRequestResponse.Links | Where-Object {$_.class -eq 'group'} $ollamaModelTagInfo = @() foreach ($ollamaModelTagLink in $ollamaModelTagLinks) { $ollamaModelTagName = $ollamaModelTagLink.href.Split('/')[-1] $ollamaModelTagInfoStart = $this.ModelTagsWebRequestResponse.Content.IndexOf($ollamaModelTagLink.outerHTML) + $ollamaModelTagLink.outerHTML.Length $ollamaModelTagIdEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagInfoStart) + '</span>'.Length $ollamaModelTagInfoEnd = $this.ModelTagsWebRequestResponse.Content.IndexOf('</span>', $ollamaModelTagIdEnd) $ollamaModelTagInfoSplit = $this.ModelTagsWebRequestResponse.Content.Substring($ollamaModelTagIdEnd, $ollamaModelTagInfoEnd - $ollamaModelTagIdEnd).Split("`n") $ollamaModelTagInfoSizeHumanReadable = $ollamaModelTagInfoSplit[0].Trim().Split(' ')[1] try {$ollamaModelTagInfoSize = [int64][scriptblock]::Create($ollamaModelTagInfoSizeHumanReadable).InvokeReturnAsIs()} catch {} $ollamaModelTagInfoUpdated = $ollamaModelTagInfoSplit[1].Trim() $ollamaModelTagInfo += [pscustomobject]@{ 'Name' = $ollamaModelTagName; 'Size' = $ollamaModelTagInfoSize; 'SizeHumanReadable' = $ollamaModelTagInfoSizeHumanReadable; 'Updated' = $ollamaModelTagInfoUpdated } } return ($this | Add-Member -MemberType 'NoteProperty' -Name 'Tags' -Value $ollamaModelTagInfo -Force -PassThru).Tags } $modelLinks | ForEach-Object { $ollamaModelLinkDescriptionDelimiterStart = '<p class="max-w-lg break-words text-neutral-800 text-md">' $ollamaModelLinkDescriptionStart = $_.outerHTML.IndexOf($ollamaModelLinkDescriptionDelimiterStart) + $ollamaModelLinkDescriptionDelimiterStart.Length $ollamaModelLinkDescriptionEnd = $_.outerHTML.IndexOf('</p>', $ollamaModelLinkDescriptionStart) $ollamaModelLinkDescription = $_.outerHTML.SubString($ollamaModelLinkDescriptionStart, $ollamaModelLinkDescriptionEnd - $ollamaModelLinkDescriptionStart).Trim() $ollamaModelLinkPullCountDelimiterStart = '<span x-test-pull-count>' $ollamaModelLinkPullCountStart = $_.outerHTML.IndexOf($ollamaModelLinkPullCountDelimiterStart) + $ollamaModelLinkPullCountDelimiterStart.Length $ollamaModelLinkPullCountEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkPullCountStart) $ollamaModelLinkPullCount = $_.outerHTML.SubString($ollamaModelLinkPullCountStart, $ollamaModelLinkPullCountEnd - $ollamaModelLinkPullCountStart).Trim() $ollamaModelLinkUpdatedDelimiterStart = '<span x-test-updated>' $ollamaModelLinkUpdatedStart = $_.outerHTML.IndexOf($ollamaModelLinkUpdatedDelimiterStart) + $ollamaModelLinkUpdatedDelimiterStart.Length $ollamaModelLinkUpdatedEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkUpdatedStart) $ollamaModelLinkUpdated = $_.outerHTML.SubString($ollamaModelLinkUpdatedStart, $ollamaModelLinkUpdatedEnd - $ollamaModelLinkUpdatedStart).Trim() $ollamaModelLinkCapabilitiesDelimiterStart = '<span x-test-capability class="inline-flex items-center rounded-md bg-indigo-50 px-2 py-0.5 text-xs font-medium text-indigo-600 sm:text-[13px]">' if ($_.outerHTML.Contains($ollamaModelLinkCapabilitiesDelimiterStart)) { $ollamaModelLinkCapabilitiesStart = $_.outerHTML.IndexOf($ollamaModelLinkCapabilitiesDelimiterStart) + $ollamaModelLinkCapabilitiesDelimiterStart.Length $ollamaModelLinkCapabilitiesEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkCapabilitiesStart) $ollamaModelLinkCapabilities = $_.outerHTML.SubString($ollamaModelLinkCapabilitiesStart, $ollamaModelLinkCapabilitiesEnd - $ollamaModelLinkCapabilitiesStart).Trim() } $ollamaModelLinkSizeDelimiterStart = '<span x-test-size class="inline-flex items-center rounded-md bg-[#ddf4ff] px-2 py-0.5 text-xs font-medium text-blue-600 sm:text-[13px]">' if ($_.outerHTML.Contains($ollamaModelLinkSizeDelimiterStart)) { $ollamaModelLinkSizeStart = $_.outerHTML.IndexOf($ollamaModelLinkSizeDelimiterStart) + $ollamaModelLinkSizeDelimiterStart.Length $ollamaModelLinkSizeEnd = $_.outerHTML.IndexOf('</span>', $ollamaModelLinkSizeStart) $ollamaModelLinkSize = $_.outerHTML.SubString($ollamaModelLinkSizeStart, $ollamaModelLinkSizeEnd - $ollamaModelLinkSizeStart).Trim() } [pscustomobject]@{ 'Name' = $_.href.Split('/')[-1].Trim(); 'Description' = $ollamaModelLinkDescription; 'PullCount' = $ollamaModelLinkPullCount; 'Updated' = $ollamaModelLinkUpdated; 'Capabilities' = $ollamaModelLinkCapabilities; 'Size' = $ollamaModelLinkSize } | Add-Member -MemberType 'ScriptProperty' -Name 'Readme' -Value $ollamaModelReadmeFunction -PassThru | Add-Member -MemberType 'ScriptProperty' -Name 'Tags' -Value $ollamaModelTagsFunction -PassThru | Add-Member -MemberType 'ScriptProperty' -Name 'ModelWebRequestResponse' -Value $ollamaModelWebRequest -PassThru | Add-Member -MemberType 'ScriptProperty' -Name 'ModelTagsWebRequestResponse' -Value $ollamaModelTagsWebRequest -PassThru } } ```
Author
Owner

@dhiltgen commented on GitHub (Nov 21, 2024):

Lets track this under #286

<!-- gh-comment-id:2491847187 --> @dhiltgen commented on GitHub (Nov 21, 2024): Lets track this under #286
Author
Owner

@bmgtr commented on GitHub (Feb 14, 2025):

+1

<!-- gh-comment-id:2659812825 --> @bmgtr commented on GitHub (Feb 14, 2025): +1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#47679