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
}Models
Create Model
Create a new custom model
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
Unique identifier for the model (max 256 characters). This will be used in API calls to reference the model.
Human-readable display name for the model
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.
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 responsesmax_tokens(integer): Maximum number of tokens to generatetop_p(number): Nucleus sampling parameterfrequency_penalty(number): Penalty for token frequencypresence_penalty(number): Penalty for token presence
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 grouppermission(string): “read” or “write”
Whether the model should be active and available for use
Response
The model’s unique identifier
ID of the user who created the model
Base model ID if specified
Model’s display name
Model parameters as provided
Model metadata as provided
Access grants for the model
Whether the model is active
Unix timestamp of creation
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)"
}
⌘I