Skip to main content
POST
/
api
/
models
/
create
Create Model
curl --request POST \
  --url https://api.example.com/api/models/create \
  --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
Unique identifier for the model (max 256 characters). This will be used in API calls to reference the model.
name
string
required
Human-readable display name for the model
base_model_id
string
Optional pointer to an existing model that should be used when proxying requests. If set, this model will act as a wrapper around the base model.
params
object
required
JSON object containing model parameters. The schema is flexible and can include any parameters supported by the base 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
Metadata about the model
profile_image_url
string
URL or data URI for the model’s profile image. Defaults to “/static/favicon.png” if not provided.
description
string
User-facing description of the model
capabilities
object
Object describing model capabilities (e.g., vision support, function calling)
access_grants
array
Optional array of access grant objects to control who can access this model. 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
Whether the model should be active and available for use

Response

id
string
The model’s unique identifier
user_id
string
ID of the user who created the model
base_model_id
string
Base model ID if specified
name
string
Model’s display name
params
object
Model parameters as provided
meta
object
Model metadata as provided
access_grants
array
Access grants for the model
is_active
boolean
Whether the model is active
created_at
integer
Unix timestamp of creation
updated_at
integer
Unix timestamp of last update

Example Request

curl -X POST "https://api.example.com/api/models/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "my-custom-gpt4",
    "name": "My Custom GPT-4",
    "base_model_id": "gpt-4",
    "params": {
      "temperature": 0.7,
      "max_tokens": 2000,
      "top_p": 1.0
    },
    "meta": {
      "description": "Custom GPT-4 model for code generation",
      "capabilities": {
        "vision": true,
        "function_calling": true
      }
    },
    "access_grants": [
      {
        "access_type": "group",
        "access_id": "developers",
        "permission": "read"
      }
    ],
    "is_active": true
  }'

Example Response

{
  "id": "my-custom-gpt4",
  "user_id": "user123",
  "base_model_id": "gpt-4",
  "name": "My Custom GPT-4",
  "params": {
    "temperature": 0.7,
    "max_tokens": 2000,
    "top_p": 1.0
  },
  "meta": {
    "profile_image_url": "/static/favicon.png",
    "description": "Custom GPT-4 model for code generation",
    "capabilities": {
      "vision": true,
      "function_calling": true
    }
  },
  "access_grants": [
    {
      "access_type": "group",
      "access_id": "developers",
      "permission": "read"
    }
  ],
  "is_active": true,
  "created_at": 1704067200,
  "updated_at": 1704067200
}

Error Responses

401
Unauthorized - User does not have permission to create models
{
  "detail": "Unauthorized"
}
400
Bad Request - Model ID already exists or is too long
{
  "detail": "Model ID is already taken"
}
{
  "detail": "Model ID is too long (max 256 characters)"
}