Browse Source

rename `/api/tags` to `/api/list`

Jeffrey Morgan 1 year ago
parent
commit
7396030d60
4 changed files with 6 additions and 5 deletions
  1. 1 1
      api/client.go
  2. 1 1
      api/client.py
  3. 3 3
      docs/api.md
  4. 1 0
      server/routes.go

+ 1 - 1
api/client.go

@@ -262,7 +262,7 @@ func (c *Client) Create(ctx context.Context, req *CreateRequest, fn CreateProgre
 
 func (c *Client) List(ctx context.Context) (*ListResponse, error) {
 	var lr ListResponse
-	if err := c.do(ctx, http.MethodGet, "/api/tags", nil, &lr); err != nil {
+	if err := c.do(ctx, http.MethodGet, "/api/list", nil, &lr); err != nil {
 		return nil, err
 	}
 	return &lr, nil

+ 1 - 1
api/client.py

@@ -157,7 +157,7 @@ def push(model_name, insecure=False, callback=None):
 # List models that are available locally.
 def list():
     try:
-        response = requests.get(f"{BASE_URL}/api/tags")
+        response = requests.get(f"{BASE_URL}/api/list")
         response.raise_for_status()
         data = response.json()
         models = data.get('models', [])

+ 3 - 3
docs/api.md

@@ -372,10 +372,10 @@ curl -T model.bin -X POST http://localhost:11434/api/blobs/sha256:29fdb92e57cf08
 
 Return 201 Created if the blob was successfully created.
 
-## List Local Models
+## List Models
 
 ```shell
-GET /api/tags
+GET /api/list
 ```
 
 List models that are available locally.
@@ -385,7 +385,7 @@ List models that are available locally.
 #### Request
 
 ```shell
-curl http://localhost:11434/api/tags
+curl http://localhost:11434/api/list
 ```
 
 #### Response

+ 1 - 0
server/routes.go

@@ -771,6 +771,7 @@ func Serve(ln net.Listener, allowOrigins []string) error {
 			c.String(http.StatusOK, "Ollama is running")
 		})
 
+		r.Handle(method, "/api/list", ListModelsHandler)
 		r.Handle(method, "/api/tags", ListModelsHandler)
 	}