[GH-ISSUE #5010] Suggestion for RFC7231 Compliant Endpoint for Model Deletion #3169

Open
opened 2026-04-12 13:39:33 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @JerrettDavis on GitHub (Jun 12, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/5010

Description:
Currently, the Ollama library’s DELETE /api/delete endpoint requires the model name to be provided in the request body. However, it would be beneficial and more in line with RFC7231 standards to support a URL-based model name specification. This approach is more intuitive and aligns with common RESTful API practices.

RFC Reference:
RFC7231 Section 4.3.5 states: "A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request." While Ollama does handle this fine, certain tooling and source-code generators may draw issue with this in the future. Especially anything targeting OpenAPI spec <3.1.

Proposed Change:
Introduce a new endpoint or modify the existing endpoint to allow specifying the model name directly in the URL path. This would make the API more user-friendly and compliant with RESTful principles, ensuring compatibility with a wider range of HTTP implementations.

Current Implementation:

curl -X DELETE http://localhost:11434/api/delete -d '{
  "name": "llama3:13b"
}'

Proposed Implementation:

curl -X DELETE http://localhost:11434/api/models/llama3:13b

Request:

  • Endpoint: DELETE /api/models/{name}
  • Parameters: name (model name to delete)
  • Response:
    • 200 OK if successful
    • 404 Not Found if the model to be deleted doesn’t exist

Benefits:

  • Enhanced clarity and usability of the API.
  • Improved compliance with established HTTP standards.
  • Avoids potential issues with HTTP implementations that reject DELETE requests with payloads.
  • Easier integration and interaction with the API for developers.

Example:

curl -X DELETE http://localhost:11434/api/models/llama3:13b

Response:

{
  "status": "success",
  "message": "Model llama3:13b deleted successfully."
}
Originally created by @JerrettDavis on GitHub (Jun 12, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/5010 **Description:** Currently, the Ollama library’s DELETE /api/delete endpoint requires the model name to be provided in the request body. However, it would be beneficial and more in line with RFC7231 standards to support a URL-based model name specification. This approach is more intuitive and aligns with common RESTful API practices. **RFC Reference:** [RFC7231 Section 4.3.5](https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.5) states: "A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request." While Ollama does handle this fine, certain tooling and source-code generators may draw issue with this in the future. Especially anything targeting OpenAPI spec <3.1. **Proposed Change:** Introduce a new endpoint or modify the existing endpoint to allow specifying the model name directly in the URL path. This would make the API more user-friendly and compliant with RESTful principles, ensuring compatibility with a wider range of HTTP implementations. **Current Implementation:** ```bash curl -X DELETE http://localhost:11434/api/delete -d '{ "name": "llama3:13b" }' ``` **Proposed Implementation:** ```bash curl -X DELETE http://localhost:11434/api/models/llama3:13b ``` **Request:** - **Endpoint:** `DELETE /api/models/{name}` - **Parameters:** `name` (model name to delete) - **Response:** - 200 OK if successful - 404 Not Found if the model to be deleted doesn’t exist **Benefits:** - Enhanced clarity and usability of the API. - Improved compliance with established HTTP standards. - Avoids potential issues with HTTP implementations that reject DELETE requests with payloads. - Easier integration and interaction with the API for developers. **Example:** ```bash curl -X DELETE http://localhost:11434/api/models/llama3:13b ``` **Response:** ```json { "status": "success", "message": "Model llama3:13b deleted successfully." } ```
GiteaMirror added the feature requestapi labels 2026-04-12 13:39:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#3169