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

# Delete Model from Credential

> Removes a specific model from an Ollama credential. Deletes the credential if no models remain.

## Path Parameters

<ParamField path="id" type="string" required>
  Credential ID
</ParamField>

<ParamField path="modelName" type="string" required>
  Model name to remove
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the model was removed successfully
</ResponseField>

<ResponseField name="message" type="string">
  Success or error message. Can be either:

  * "Model removed successfully"
  * "Credential deleted (no models remaining)"
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url http://localhost:3000/api/v1/credentials/cred_123abc/models/llama2 \
    --header 'Authorization: Bearer <token>'
  ```

  ```javascript JavaScript theme={null}
  const credentialId = 'cred_123abc';
  const modelName = 'llama2';

  const response = await fetch(
    `http://localhost:3000/api/v1/credentials/${credentialId}/models/${modelName}`,
    {
      method: 'DELETE',
      headers: {
        'Authorization': 'Bearer <token>'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  credential_id = "cred_123abc"
  model_name = "llama2"

  url = f"http://localhost:3000/api/v1/credentials/{credential_id}/models/{model_name}"
  headers = {"Authorization": "Bearer <token>"}

  response = requests.delete(url, headers=headers)
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Model Removed theme={null}
  {
    "success": true,
    "message": "Model removed successfully"
  }
  ```

  ```json 200 - Credential Deleted theme={null}
  {
    "success": true,
    "message": "Credential deleted (no models remaining)"
  }
  ```

  ```json 400 - Bad Request theme={null}
  {
    "success": false,
    "message": "This operation is only for Ollama credentials"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "success": false,
    "message": "Unauthorized"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "success": false,
    "message": "Credential not found"
  }
  ```
</ResponseExample>

## Notes

<Info>
  This endpoint is **specifically for Ollama credentials** that manage multiple models.
</Info>

* When the last model is removed, the entire credential is automatically deleted
* This operation is only valid for Ollama provider credentials
* Attempting to use this on non-Ollama credentials will return a 400 error
* Model names must match exactly (case-sensitive)

## Behavior

1. If the credential has multiple models, the specified model is removed
2. If the credential has only one model (the one being deleted), the entire credential is deleted
3. The response message indicates which action was taken
