# List base models

GET

/v2/workspaces/{workspace\_id}/base-models

```bash
curl --request GET \
  --url https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models \
  --header 'Authorization: Bearer <token>'
```

```python
import requests


url = "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models"


headers = {"Authorization": "Bearer <token>"}


response = requests.get(url, headers=headers)


print(response.json())
```

```js
const url = 'https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main


import (
  "fmt"
  "net/http"
  "io"
)


func main() {


  url := "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models"


  req, _ := http.NewRequest("GET", url, nil)


  req.Header.Add("Authorization", "Bearer <token>")


  res, _ := http.DefaultClient.Do(req)


  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)


  fmt.Println(res)
  fmt.Println(string(body))


}
```

```php
<?php


$curl = curl_init();


curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);


$response = curl_exec($curl);
$err = curl_error($curl);


curl_close($curl);


if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

```java
OkHttpClient client = new OkHttpClient();


Request request = new Request.Builder()
  .url("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models")
  .get()
  .addHeader("Authorization", "Bearer <token>")
  .build();


Response response = client.newCall(request).execute();
```

```ruby
require 'uri'
require 'net/http'


url = URI("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models")


http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true


request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'


response = http.request(request)
puts response.read_body
```

```csharp
var client = new RestClient("https://api.app.layer.ai/api/v2/workspaces/:workspace_id/base-models");
var request = new RestRequest("", Method.Get);
request.AddHeader("Authorization", "Bearer <token>");
var response = client.Execute(request);
```

* Layer API

> **Changed in v2.** This endpoint’s contract differs from v1\. See the [v2 migration guide](/docs/migration) for the request and response changes before you switch.

List the base models enabled for this workspace, sourced from the model registry. Results come back in Layer’s recommended order, which reflects synced quality and popularity signals and can therefore shift between requests. Reference sets are listed separately under /reference-sets.

## Authorizations

* **[bearerAuth](/docs/v2/rest-api#bearerauth)**
* **[oauth2](/docs/v2/rest-api#oauth2)**

## Parameters

### Path Parameters

**workspace\_id**

required

_Workspace Id_

Id of the workspace that owns the resource.

string format: uuid

Id of the workspace that owns the resource.

### Query Parameters

**modality**

Any of:

**Modality**

_Modality_

string

Allowed values: text image audio video three\_d playable

**null**

null

Filter by output modality

**search**

Any of:

**string**

string

**null**

null

Full-text search on name, aliases, and description

**limit**

_Limit_

Maximum number of results to return.

integer

default: 20 \>= 1 <= 100

Maximum number of results to return.

**cursor**

Any of:

**string**

string

**null**

null

Cursor from a previous response to fetch the next page.

## Responses

### 200

Successful Response

_ListBaseModelsOutput_object

**base\_models**

required

_Base Models_

Array<object>

_BaseModelSummary_object

**base\_model\_id**

required

_Base Model Id_

Base model identifier, e.g. flux-dev — pass it as `base_model_id`.

string

**name**

required

_Name_

Display name.

string

**aliases**

_Aliases_

Community nicknames this model is also known by.

Array<string>

default: 

**modality**

required

_Modality_

Image, video, three\_d, or audio.

string

Allowed values: text image audio video three\_d playable

**description**

Any of:

**string**

string

**null**

null

**price\_per\_unit**

Any of:

**number**

number

**null**

null

**price\_unit**

Any of:

**string**

string

**null**

null

**inference\_timing**

required

_Inference Timing_

Typical generation time range, e.g. ‘5-15s’.

string

**pagination**

required

_PaginationOutput_object

**next\_cursor**

Any of:

**string**

string

**null**

null

**has\_more\_results**

required

_Has More Results_

If there are more results to page through

boolean

**total\_count**

Any of:

**integer**

integer

**null**

null

##### Example

```json
{
  "base_models": [
    {
      "aliases": [],
      "modality": "text"
    }
  ]
}
```

### 401

Unauthenticated — missing or invalid Bearer token.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 403

Forbidden — insufficient permissions, or the access token lacks the scope the operation requires.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 404

Resource not found.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 409

The request with this `Idempotency-Key` is still running — retry after the number of seconds in `Retry-After`.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 422

Invalid input parameters, or an `Idempotency-Key` reused for a different request.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 429

Rate limited — retry after the number of seconds in `Retry-After`.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```

### 500

Internal server error.

object

**type**

required

string

**title**

required

string

**status**

required

integer

**detail**

required

string

##### Example

```json
{
  "type": "https://api.layer.ai/errors/ERROR_CODE",
  "title": "Error Title",
  "status": 400,
  "detail": "Human-readable description."
}
```
