[GH-ISSUE #1942] There seems to be no way to query the ollama API with an already defined modelfile #1117

Closed
opened 2026-04-12 10:51:56 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @Leopere on GitHub (Jan 12, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/1942

There seems to be no way to query the ollama API with an already defined modelfile

Originally created by @Leopere on GitHub (Jan 12, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/1942 There seems to be no way to query the ollama API with an already defined modelfile
Author
Owner

@jimscard commented on GitHub (Jan 12, 2024):

The API doesn't take modelfiles -- it uses models. Before you can use a model with the API, you need to first either create the actual model, e.g., ollama create modelname -f modelfile or pull an existing model from the library, for example, ollama pull mistral:latest.

Note that this would have received faster response via the Ollama Discord server - https://discord.gg/ollama

<!-- gh-comment-id:1888452819 --> @jimscard commented on GitHub (Jan 12, 2024): The API doesn't take *modelfiles* -- it uses *models*. Before you can use a model with the API, you need to first either create the actual model, e.g., `ollama create modelname -f modelfile` or pull an existing model from the library, for example, `ollama pull mistral:latest`. Note that this would have received faster response via the Ollama Discord server - https://discord.gg/ollama
Author
Owner

@mxyng commented on GitHub (Jan 13, 2024):

Recent version of Ollama will takes Modelfile content for create requests so you could do something like this

curl -X POST http://127.0.0.1:11434/api/create -d '{
  "name": "new-model",
  "modelfile": "FROM llama2\nPARAMETER temperature 0\n"
}'

But as @jimscard has already mentioned, most APIs operate on models, not modelfiles

<!-- gh-comment-id:1890231454 --> @mxyng commented on GitHub (Jan 13, 2024): Recent version of Ollama will takes Modelfile content for create requests so you could do something like this ``` curl -X POST http://127.0.0.1:11434/api/create -d '{ "name": "new-model", "modelfile": "FROM llama2\nPARAMETER temperature 0\n" }' ``` But as @jimscard has already mentioned, most APIs operate on models, not modelfiles
Author
Owner

@Leopere commented on GitHub (Jan 13, 2024):

Recent version of Ollama will takes Modelfile content for create requests so you could do something like this

curl -X POST http://127.0.0.1:11434/api/create -d '{
  "name": "new-model",
  "modelfile": "FROM llama2\nPARAMETER temperature 0\n"
}'

But as @jimscard has already mentioned, most APIs operate on models, not modelfiles

I'm looking to send things to my ollama webUI via curl or go or some other programmatic thing and was hoping to benefit from the modelfiles I've tunned.

<!-- gh-comment-id:1890293628 --> @Leopere commented on GitHub (Jan 13, 2024): > Recent version of Ollama will takes Modelfile content for create requests so you could do something like this > > ``` > curl -X POST http://127.0.0.1:11434/api/create -d '{ > "name": "new-model", > "modelfile": "FROM llama2\nPARAMETER temperature 0\n" > }' > ``` > > But as @jimscard has already mentioned, most APIs operate on models, not modelfiles I'm looking to send things to my ollama webUI via curl or go or some other programmatic thing and was hoping to benefit from the modelfiles I've tunned.
Author
Owner

@easp commented on GitHub (Jan 13, 2024):

@Leopere What do you mean by "modelfile" Are you talking about fine-tuned weights for a model, or are your referring to an Ollama modelfile?

If it's the former, you need to make sure they are a supported model architecture and convert them into a gguf, then you need to import them into Ollama, which involves creation of an Ollama modelfile, as mentioned above.

If you are talking about the latter, then you just reference the modelname you used when you created a custom Ollama model using the modelfile.

If it's neither of those things you'll need to provide a clearer explanation of what you are trying to do and where you are running into difficulties.

<!-- gh-comment-id:1890745411 --> @easp commented on GitHub (Jan 13, 2024): @Leopere What do you mean by "modelfile" Are you talking about fine-tuned weights for a model, or are your referring to an [Ollama modelfile](https://github.com/jmorganca/ollama/blob/main/docs/modelfile.md)? If it's the former, you need to make sure they are a supported model architecture and convert them into a gguf, then you need to [import them into Ollama](https://github.com/jmorganca/ollama/blob/main/docs/import.md), which involves creation of an Ollama modelfile, as mentioned above. If you are talking about the latter, then you just reference the modelname you used when you created a custom Ollama model using the modelfile. If it's neither of those things you'll need to provide a clearer explanation of what you are trying to do and where you are running into difficulties.
Author
Owner

@Leopere commented on GitHub (Jan 15, 2024):

If you are talking about the latter, then you just reference the modelname you used when you created a custom Ollama model using the modelfile.

This is perfect thanks for the confirmation.

<!-- gh-comment-id:1891331978 --> @Leopere commented on GitHub (Jan 15, 2024): > If you are talking about the latter, then you just reference the modelname you used when you created a custom Ollama model using the modelfile. This is perfect thanks for the confirmation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1117