Skip to main content
PATCH
https://api.keywordsai.co
/
api
/
models
/
{model_name}
import requests

model_name = "my-custom-gpt-4"
url = f"https://api.keywordsai.co/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())
{
  "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
  }
}
Update a specific custom model. Only the provided fields will be updated - other fields remain unchanged.
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

Path parameters

model_name
string
required
The model’s unique name to update.
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.
"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.
"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.
{
  "supported_params_override": {
    "temperature": {
      "name": "temperature",
      "type": "number",
      "default": 0.7,
      "min": 0,
      "max": 1.5
    }
  }
}

Response

Returns the updated model object.
{
  "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
  }
}
import requests

model_name = "my-custom-gpt-4"
url = f"https://api.keywordsai.co/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())