Update custom model

Update a specific custom model. Only the provided fields will be updated - other fields remain unchanged. <Note> **Restrictions**: - Only custom models can be updated (not global models) - The `model_name` field is read-only and cannot be changed - Only the owning organization can update their custom models </Note> ## Path parameters - `model_name` *string* **required**: The model's unique name to update. **Example** ``` my-custom-gpt-4 ``` ## Request body All fields are optional. Only provide the fields you want to update. - `display_name` *string*: Human-readable display name for the model. **Example** ```json "display_name": "My Updated Custom GPT-4" ``` - `custom_provider_id` *integer | string*: ID or `provider_id` of the custom provider to associate with this model. ### Pricing - `input_cost` *float*: Cost per 1M input tokens in USD. **Example** ```json "input_cost": 0.030 ``` - `output_cost` *float*: Cost per 1M output tokens in USD. - `cache_hit_input_cost` *float*: Cost per 1M cached input tokens in USD. - `cache_creation_input_cost` *float*: Cost per 1M cache creation tokens in USD. ### Capabilities - `max_context_window` *integer*: Maximum context window size for the model. - `streaming_support` *integer*: Streaming support. `0` for no, `1` for yes. - `function_call` *integer*: Function calling support. `0` for no, `1` for yes. - `image_support` *integer*: Image/vision support. `0` for no, `1` for yes. - `supported_params_override` *object*: Partial override of UI parameter support. New overrides are merged with existing ones. **Example** ```json { "supported_params_override": { "temperature": { "name": "temperature", "type": "number", "default": 0.7, "min": 0, "max": 1.5 } } } ``` ## Response Returns the updated model object. ```json 200 OK { "id": "my-custom-gpt-4", "model_name": "my-custom-gpt-4", "display_name": "My Updated Custom GPT-4", "base_model_name": "gpt-4", "affiliation_category": "custom", "input_cost": 0.030, "output_cost": 0.075, "max_context_window": 8192, "streaming_support": 1, "function_call": 1, "image_support": 0, "source": "db", "provider": { "id": "my-custom-provider", "provider_id": "my-custom-provider", "provider_name": "My Custom Provider", "organization_id": 123 } } ``` ```json 403 Forbidden { "detail": "Cannot modify hardcoded models. They are synced from code and will be overwritten on next deployment. Only database-only models can be modified." } ``` ```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", "Content-Type": "application/json" } payload = { "display_name": "My Updated Custom GPT-4", "input_cost": 0.030 } response = requests.patch(url, headers=headers, json=payload) print(response.json()) ``` ```typescript TypeScript const modelName = 'my-custom-gpt-4'; const url = `https://api.respan.ai/api/models/${modelName}/`; const headers = { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }; const payload = { display_name: 'My Updated Custom GPT-4', input_cost: 0.030 }; const response = await fetch(url, { method: 'PATCH', headers: headers, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data); ``` ```bash cURL curl -X PATCH "https://api.respan.ai/api/models/my-custom-gpt-4/" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "display_name": "My Updated Custom GPT-4", "input_cost": 0.030 }' ```

Authentication

AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys

Path parameters

model_namestringRequired
The model's unique name to update.

Request

This endpoint expects an object.
display_namestringOptional

Human-readable display name for the model.

custom_provider_idinteger or stringOptional

ID or provider_id of the custom provider to associate with this model.

input_costdoubleOptional
Cost per 1M input tokens in USD.
output_costdoubleOptional
Cost per 1M output tokens in USD.
cache_hit_input_costdoubleOptional
Cost per 1M cached input tokens in USD.
cache_creation_input_costdoubleOptional
Cost per 1M cache creation tokens in USD.
max_context_windowintegerOptional
Maximum context window size for the model.
streaming_supportintegerOptional
Streaming support. 0 for no, 1 for yes.
function_callintegerOptional
Function calling support. 0 for no, 1 for yes.
image_supportintegerOptional

Image/vision support. 0 for no, 1 for yes.

supported_params_overrideobjectOptional
Partial override of UI parameter support. New overrides are merged with existing ones.

Response

Successful response for Update custom model
supported_params_overrideobject

Errors

401
Unauthorized Error