Create Model
curl --request POST \
--url https://api.example.com/assets/models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentials": {
"api_key": "sk-..."
},
"litellm_model": "openai/gpt-4o",
"mode": "chat",
"name": "GPT-4o",
"provider": "openai",
"tags": [
"production",
"openai"
]
}
'import requests
url = "https://api.example.com/assets/models"
payload = {
"credentials": { "api_key": "sk-..." },
"litellm_model": "openai/gpt-4o",
"mode": "chat",
"name": "GPT-4o",
"provider": "openai",
"tags": ["production", "openai"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentials: {api_key: 'sk-...'},
litellm_model: 'openai/gpt-4o',
mode: 'chat',
name: 'GPT-4o',
provider: 'openai',
tags: ['production', 'openai']
})
};
fetch('https://api.example.com/assets/models', 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/assets/models",
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([
'credentials' => [
'api_key' => 'sk-...'
],
'litellm_model' => 'openai/gpt-4o',
'mode' => 'chat',
'name' => 'GPT-4o',
'provider' => 'openai',
'tags' => [
'production',
'openai'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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/assets/models"
payload := strings.NewReader("{\n \"credentials\": {\n \"api_key\": \"sk-...\"\n },\n \"litellm_model\": \"openai/gpt-4o\",\n \"mode\": \"chat\",\n \"name\": \"GPT-4o\",\n \"provider\": \"openai\",\n \"tags\": [\n \"production\",\n \"openai\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/assets/models")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentials\": {\n \"api_key\": \"sk-...\"\n },\n \"litellm_model\": \"openai/gpt-4o\",\n \"mode\": \"chat\",\n \"name\": \"GPT-4o\",\n \"provider\": \"openai\",\n \"tags\": [\n \"production\",\n \"openai\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/assets/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentials\": {\n \"api_key\": \"sk-...\"\n },\n \"litellm_model\": \"openai/gpt-4o\",\n \"mode\": \"chat\",\n \"name\": \"GPT-4o\",\n \"provider\": \"openai\",\n \"tags\": [\n \"production\",\n \"openai\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"resource_uri": "<string>",
"name": "<string>",
"litellm_model": "<string>",
"status": "PENDING",
"organization_id": "<string>",
"project_id": "<string>",
"owner_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_by": "<string>",
"description": "<string>",
"tags": [],
"provider": "<string>",
"api_base": "<string>",
"api_version": "<string>",
"mode": "chat",
"max_input_tokens": 123,
"max_output_tokens": 123,
"rpm": 123,
"tpm": 123,
"default_temperature": 123,
"default_max_tokens": 123,
"timeout": 123,
"status_message": "<string>"
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}models
Create Model
Create model
POST
/
assets
/
models
Create Model
curl --request POST \
--url https://api.example.com/assets/models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentials": {
"api_key": "sk-..."
},
"litellm_model": "openai/gpt-4o",
"mode": "chat",
"name": "GPT-4o",
"provider": "openai",
"tags": [
"production",
"openai"
]
}
'import requests
url = "https://api.example.com/assets/models"
payload = {
"credentials": { "api_key": "sk-..." },
"litellm_model": "openai/gpt-4o",
"mode": "chat",
"name": "GPT-4o",
"provider": "openai",
"tags": ["production", "openai"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentials: {api_key: 'sk-...'},
litellm_model: 'openai/gpt-4o',
mode: 'chat',
name: 'GPT-4o',
provider: 'openai',
tags: ['production', 'openai']
})
};
fetch('https://api.example.com/assets/models', 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/assets/models",
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([
'credentials' => [
'api_key' => 'sk-...'
],
'litellm_model' => 'openai/gpt-4o',
'mode' => 'chat',
'name' => 'GPT-4o',
'provider' => 'openai',
'tags' => [
'production',
'openai'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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/assets/models"
payload := strings.NewReader("{\n \"credentials\": {\n \"api_key\": \"sk-...\"\n },\n \"litellm_model\": \"openai/gpt-4o\",\n \"mode\": \"chat\",\n \"name\": \"GPT-4o\",\n \"provider\": \"openai\",\n \"tags\": [\n \"production\",\n \"openai\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/assets/models")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentials\": {\n \"api_key\": \"sk-...\"\n },\n \"litellm_model\": \"openai/gpt-4o\",\n \"mode\": \"chat\",\n \"name\": \"GPT-4o\",\n \"provider\": \"openai\",\n \"tags\": [\n \"production\",\n \"openai\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/assets/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentials\": {\n \"api_key\": \"sk-...\"\n },\n \"litellm_model\": \"openai/gpt-4o\",\n \"mode\": \"chat\",\n \"name\": \"GPT-4o\",\n \"provider\": \"openai\",\n \"tags\": [\n \"production\",\n \"openai\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"resource_uri": "<string>",
"name": "<string>",
"litellm_model": "<string>",
"status": "PENDING",
"organization_id": "<string>",
"project_id": "<string>",
"owner_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_by": "<string>",
"description": "<string>",
"tags": [],
"provider": "<string>",
"api_base": "<string>",
"api_version": "<string>",
"mode": "chat",
"max_input_tokens": 123,
"max_output_tokens": 123,
"rpm": 123,
"tpm": 123,
"default_temperature": 123,
"default_max_tokens": 123,
"timeout": 123,
"status_message": "<string>"
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"code": "INVALID_REQUEST",
"message": "<string>",
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"details": {}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
application/json
Request body for creating a model configuration.
Required string length:
1 - 255Required string length:
1 - 500Credentials for the model provider. Stored as secrets.
Show child attributes
Show child attributes
Custom kebab-case name for the resource URI. Auto-generated from name if omitted.
Pattern:
^[a-z0-9-]+$Maximum string length:
100Maximum string length:
1000Maximum string length:
1000Maximum string length:
50Supported model modes.
Available options:
chat, completion, embedding, image_generation, audio_transcription Required range:
0 <= x <= 9.99Response
Successful Response
Full model representation.
Status of a model configuration.
Available options:
PENDING, ACTIVE, ERROR, DEPRECATED, DISABLED Deprecated: use created_by instead. Will be removed in a future release.
Supported model modes.
Available options:
chat, completion, embedding, image_generation, audio_transcription Was this page helpful?

