Delete custom model
Delete a specific custom model from your organization.
<Note>
**Important**: This action is permanent and cannot be undone. Only custom models (`source: "db"`) can be deleted. Hardcoded models synced from code cannot be deleted as they will be recreated on the next deployment.
</Note>
## Path parameters
- `model_name` *string* **required**: The model's unique name to delete.
**Example**
```
my-custom-gpt-4
```
## Response
Returns no content on successful deletion.
```text 204 No Content
```
```json 403 Forbidden
{
"detail": "Cannot delete hardcoded models. They are synced from code and will be recreated on next deployment. Only database-only models can be deleted."
}
```
```json 404 Not Found
{
"detail": "Not found."
}
```
```json 401 Unauthorized
{
"detail": "Authentication credentials were not provided."
}
```
```python Python
model_name = "my-custom-gpt-4"
url = f"https://api.respan.ai/api/models/{model_name}/"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.delete(url, headers=headers)
print(f"Status code: {response.status_code}")
```
```typescript TypeScript
const modelName = 'my-custom-gpt-4';
const url = `https://api.respan.ai/api/models/${modelName}/`;
const headers = {
'Authorization': 'Bearer YOUR_API_KEY'
};
const response = await fetch(url, {
method: 'DELETE',
headers: headers
});
console.log(`Status code: ${response.status}`);
```
```bash cURL
curl -X DELETE "https://api.respan.ai/api/models/my-custom-gpt-4/" \
-H "Authorization: Bearer YOUR_API_KEY"
```
Authentication
AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys
Path parameters
model_name
The model's unique name to delete.
Response
No content
Errors
401
Unauthorized Error