Skip to main content
POST
/
api
/
models
/
model
/
update
Update Model
curl --request POST \
  --url https://api.example.com/api/models/model/update \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "<string>",
  "name": "<string>",
  "base_model_id": "<string>",
  "params": {},
  "meta": {
    "profile_image_url": "<string>",
    "description": "<string>",
    "capabilities": {}
  },
  "access_grants": [
    {}
  ],
  "is_active": true
}
'
{
  "id": "<string>",
  "user_id": "<string>",
  "base_model_id": "<string>",
  "name": "<string>",
  "params": {},
  "meta": {},
  "access_grants": [
    {}
  ],
  "is_active": true,
  "created_at": 123,
  "updated_at": 123
}

Body Parameters

id
string
required
The unique identifier of the model to update. This field cannot be changed - it must match an existing model.
name
string
required
Updated human-readable display name for the model
base_model_id
string
Updated base model ID that should be used when proxying requests
params
object
required
Updated model parameters. This object can contain any parameters supported by the model.Common parameters:
  • temperature (number): Controls randomness in responses
  • max_tokens (integer): Maximum number of tokens to generate
  • top_p (number): Nucleus sampling parameter
  • frequency_penalty (number): Penalty for token frequency
  • presence_penalty (number): Penalty for token presence
meta
object
required
Updated metadata about the model
profile_image_url
string
Updated URL or data URI for the model’s profile image
description
string
Updated user-facing description of the model
capabilities
object
Updated object describing model capabilities
access_grants
array
Updated array of access grant objects. If provided, this will replace all existing access grants.Each grant should specify:
  • access_type (string): “user” or “group”
  • access_id (string): ID of the user or group
  • permission (string): “read” or “write”
is_active
boolean
default:true
Updated active status of the model

Response

id
string
The model’s unique identifier
user_id
string
ID of the user who created the model (unchanged)
base_model_id
string
Updated base model ID
name
string
Updated model name
params
object
Updated model parameters
meta
object
Updated model metadata
access_grants
array
Updated access grants for the model
is_active
boolean
Updated active status
created_at
integer
Unix timestamp of original creation (unchanged)
updated_at
integer
Unix timestamp of this update

Example Request

curl -X POST "https://api.example.com/api/models/model/update" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "my-custom-gpt4",
    "name": "Updated Custom GPT-4",
    "base_model_id": "gpt-4-turbo",
    "params": {
      "temperature": 0.8,
      "max_tokens": 4000,
      "top_p": 0.95
    },
    "meta": {
      "description": "Enhanced GPT-4 model with higher creativity",
      "capabilities": {
        "vision": true,
        "function_calling": true,
        "json_mode": true
      }
    },
    "access_grants": [
      {
        "access_type": "group",
        "access_id": "developers",
        "permission": "write"
      },
      {
        "access_type": "user",
        "access_id": "user456",
        "permission": "read"
      }
    ],
    "is_active": true
  }'

Example Response

{
  "id": "my-custom-gpt4",
  "user_id": "user123",
  "base_model_id": "gpt-4-turbo",
  "name": "Updated Custom GPT-4",
  "params": {
    "temperature": 0.8,
    "max_tokens": 4000,
    "top_p": 0.95
  },
  "meta": {
    "profile_image_url": "/static/favicon.png",
    "description": "Enhanced GPT-4 model with higher creativity",
    "capabilities": {
      "vision": true,
      "function_calling": true,
      "json_mode": true
    }
  },
  "access_grants": [
    {
      "access_type": "group",
      "access_id": "developers",
      "permission": "write"
    },
    {
      "access_type": "user",
      "access_id": "user456",
      "permission": "read"
    }
  ],
  "is_active": true,
  "created_at": 1704067200,
  "updated_at": 1704240000
}

Error Responses

401
Unauthorized - Model not found
{
  "detail": "Model not found"
}
400
Bad Request - User does not have write access to this model
{
  "detail": "Access prohibited"
}

Permissions

To update a model, the user must:
  • Be the owner of the model (user_id matches), OR
  • Have write access granted through access_grants, OR
  • Be an admin user