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
}
'import requests
url = "https://api.example.com/api/models/create"
payload = {
"id": "<string>",
"name": "<string>",
"base_model_id": "<string>",
"params": {},
"meta": {
"profile_image_url": "<string>",
"description": "<string>",
"capabilities": {}
},
"access_grants": [{}],
"is_active": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: '<string>',
name: '<string>',
base_model_id: '<string>',
params: {},
meta: {profile_image_url: '<string>', description: '<string>', capabilities: {}},
access_grants: [{}],
is_active: true
})
};
fetch('https://api.example.com/api/models/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/models/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '<string>',
'name' => '<string>',
'base_model_id' => '<string>',
'params' => [
],
'meta' => [
'profile_image_url' => '<string>',
'description' => '<string>',
'capabilities' => [
]
],
'access_grants' => [
[
]
],
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/models/create"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"base_model_id\": \"<string>\",\n \"params\": {},\n \"meta\": {\n \"profile_image_url\": \"<string>\",\n \"description\": \"<string>\",\n \"capabilities\": {}\n },\n \"access_grants\": [\n {}\n ],\n \"is_active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/models/create")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"base_model_id\": \"<string>\",\n \"params\": {},\n \"meta\": {\n \"profile_image_url\": \"<string>\",\n \"description\": \"<string>\",\n \"capabilities\": {}\n },\n \"access_grants\": [\n {}\n ],\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/models/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"base_model_id\": \"<string>\",\n \"params\": {},\n \"meta\": {\n \"profile_image_url\": \"<string>\",\n \"description\": \"<string>\",\n \"capabilities\": {}\n },\n \"access_grants\": [\n {}\n ],\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"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
}
'import requests
url = "https://api.example.com/api/models/create"
payload = {
"id": "<string>",
"name": "<string>",
"base_model_id": "<string>",
"params": {},
"meta": {
"profile_image_url": "<string>",
"description": "<string>",
"capabilities": {}
},
"access_grants": [{}],
"is_active": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: '<string>',
name: '<string>',
base_model_id: '<string>',
params: {},
meta: {profile_image_url: '<string>', description: '<string>', capabilities: {}},
access_grants: [{}],
is_active: true
})
};
fetch('https://api.example.com/api/models/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/models/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '<string>',
'name' => '<string>',
'base_model_id' => '<string>',
'params' => [
],
'meta' => [
'profile_image_url' => '<string>',
'description' => '<string>',
'capabilities' => [
]
],
'access_grants' => [
[
]
],
'is_active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/models/create"
payload := strings.NewReader("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"base_model_id\": \"<string>\",\n \"params\": {},\n \"meta\": {\n \"profile_image_url\": \"<string>\",\n \"description\": \"<string>\",\n \"capabilities\": {}\n },\n \"access_grants\": [\n {}\n ],\n \"is_active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/models/create")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"base_model_id\": \"<string>\",\n \"params\": {},\n \"meta\": {\n \"profile_image_url\": \"<string>\",\n \"description\": \"<string>\",\n \"capabilities\": {}\n },\n \"access_grants\": [\n {}\n ],\n \"is_active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/models/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"base_model_id\": \"<string>\",\n \"params\": {},\n \"meta\": {\n \"profile_image_url\": \"<string>\",\n \"description\": \"<string>\",\n \"capabilities\": {}\n },\n \"access_grants\": [\n {}\n ],\n \"is_active\": true\n}"
response = http.request(request)
puts response.read_body{
"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
string
required
Unique identifier for the model (max 256 characters). This will be used in API calls to reference the model.
string
required
Human-readable display name for the model
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.
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 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
object
required
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 grouppermission(string): “read” or “write”
boolean
default:true
Whether the model should be active and available for use
Response
string
The model’s unique identifier
string
ID of the user who created the model
string
Base model ID if specified
string
Model’s display name
object
Model parameters as provided
object
Model metadata as provided
array
Access grants for the model
boolean
Whether the model is active
integer
Unix timestamp of creation
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
Unauthorized - User does not have permission to create models
{
"detail": "Unauthorized"
}
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)"
}