> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nemu.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

> Manage the models served by a workspace's providers

A model is served by a provider inside a workspace. Pass `workspace_id` on reads and writes.
Reads need `models:read` and writes need `models:write`.

## List models

```
GET /api/v1/models?workspace_id=ws_1
```

<RequestExample>
  ```bash cURL theme={null}
  curl 'https://platform.nemu.cc/api/v1/models?workspace_id=ws_1' \
    -H 'Authorization: Bearer <access_token>'
  ```

  ```ts SDK theme={null}
  const models = await workspace.models.list();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "mdl_1",
        "user_id": "3f0e...",
        "provider_id": "prov_1",
        "name": "gpt-oss-120b",
        "display_name": "GPT OSS 120B",
        "api_name": "gpt-oss-120b",
        "type": "chat",
        "input_cost": 0.1,
        "output_cost": 0.3,
        "gateway_name": "primary/gpt-oss-120b",
        "context_window": 131072,
        "created_at": "2026-01-04T10:22:00.000Z",
        "updated_at": "2026-01-04T10:22:00.000Z"
      }
    ]
  }
  ```
</ResponseExample>

Send `gateway_name` to the gateway to route inference to this model.

## Get a model

```
GET /api/v1/models/{id}?workspace_id=ws_1
```

## Create a model

```
POST /api/v1/models
```

<ParamField body="workspace_id" type="string" required>
  The workspace the model belongs to.
</ParamField>

<ParamField body="provider_id" type="string" required>
  The provider that serves the model.
</ParamField>

<ParamField body="name" type="string" required>
  The internal model name.
</ParamField>

<ParamField body="display_name" type="string" required>
  A readable label for the model.
</ParamField>

<ParamField body="type" type="string" required>
  One of `chat`, `embedding`, `moderation`, `vision`, `audio`, or `image`.
</ParamField>

<ParamField body="input_cost" type="number" required>
  Cost per input unit.
</ParamField>

<ParamField body="output_cost" type="number" required>
  Cost per output unit.
</ParamField>

<ParamField body="context_window" type="integer" required>
  The context window size in tokens.
</ParamField>

<ParamField body="api_name" type="string">
  The name the upstream provider expects, if it differs from `name`.
</ParamField>

<RequestExample>
  ```ts SDK theme={null}
  const model = await workspace.models.create({
    provider_id: "prov_1",
    name: "gpt-oss-120b",
    display_name: "GPT OSS 120B",
    type: "chat",
    input_cost: 0.1,
    output_cost: 0.3,
    context_window: 131072,
  });
  ```
</RequestExample>

## Update a model

```
PATCH /api/v1/models/{id}
```

Accepts any create field except `provider_id`. Send `workspace_id` in the body.

## Delete a model

```
DELETE /api/v1/models/{id}
```
