Can we get an ollama.stop? #143

Open
opened 2026-02-15 16:28:16 -05:00 by yindo · 8 comments
Owner

Originally created by @JTMarsh556 on GitHub (Sep 22, 2024).

Originally assigned to: @ParthSareen on GitHub.

ollama stop was a great addition. I was hoping we could get stop added to the API library.

Thanks

Originally created by @JTMarsh556 on GitHub (Sep 22, 2024). Originally assigned to: @ParthSareen on GitHub. ollama stop was a great addition. I was hoping we could get stop added to the API library. Thanks
Author
Owner

@davidearlyoung commented on GitHub (Oct 1, 2024):

I second this as well. And to keep things clear. I'm talking about making available in the ollama python lib the same behavior you get when you run ollama stop <target_model> from terminal. Which is what I believe what JTMarsh556 is also asking.

@davidearlyoung commented on GitHub (Oct 1, 2024): I second this as well. And to keep things clear. I'm talking about making available in the ollama python lib the same behavior you get when you run `ollama stop <target_model>` from terminal. Which is what I believe what JTMarsh556 is also asking.
Author
Owner

@jcgordon10 commented on GitHub (Oct 3, 2024):

+1
I'm writing a script and want to be able to call it with different models as a parameter, but I need to be able to have the script stop the model it's using at the end of it's execution, that way the way is clear for if I call with a different model.

@jcgordon10 commented on GitHub (Oct 3, 2024): +1 I'm writing a script and want to be able to call it with different models as a parameter, but I need to be able to have the script stop the model it's using at the end of it's execution, that way the way is clear for if I call with a different model.
Author
Owner

@wallscreet commented on GitHub (Nov 7, 2024):

The generate and chat methods both accept a float for keep-alive. When hot-switching models, I set my keep-alive=0 at the call and it should unload immediately (at least that's been my observation).

@wallscreet commented on GitHub (Nov 7, 2024): The generate and chat methods both accept a float for keep-alive. When hot-switching models, I set my keep-alive=0 at the call and it should unload immediately (at least that's been my observation).
Author
Owner

@ParthSareen commented on GitHub (Nov 25, 2024):

Great - thanks for bringing - will scope in :)

@ParthSareen commented on GitHub (Nov 25, 2024): Great - thanks for bringing - will scope in :)
Author
Owner

@liponex commented on GitHub (Dec 18, 2024):

Also, as I understand, there can be multiple generations at once through AsyncClient. So better would be adding stop function as returning handle from client.chat, client.generate and etc.

@liponex commented on GitHub (Dec 18, 2024): Also, as I understand, there can be multiple generations at once through `AsyncClient`. So better would be adding `stop` function as returning handle from `client.chat`, `client.generate` and etc.
Author
Owner

@ckuethe commented on GitHub (Apr 12, 2025):

I'd like to see both ollama force-quit to immediate kill all running models no matter what, regardless of any work already done; and ollama drain to allow whatever requests are in progress to finish while refusing any new ones - even on open connections.

@ckuethe commented on GitHub (Apr 12, 2025): I'd like to see both `ollama force-quit` to immediate kill all running models no matter what, regardless of any work already done; and `ollama drain` to allow whatever requests are in progress to finish while refusing any new ones - even on open connections.
Author
Owner

@MERakram commented on GitHub (May 22, 2025):

Any updates on this? or any alternatives to the abort the generation programmatically (kill specific generation or model)

@MERakram commented on GitHub (May 22, 2025): Any updates on this? or any alternatives to the abort the generation programmatically (kill specific generation or model)
Author
Owner

@andrea-lorenzetti commented on GitHub (Aug 22, 2025):

Was this function implemented? I dont see it in the docs

@andrea-lorenzetti commented on GitHub (Aug 22, 2025): Was this function implemented? I dont see it in the docs
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#143