Create Lora
curl --request POST \
--url https://api.deepinfra.com/v1/lora/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_model": "<string>",
"lora_name": "<string>",
"source": {
"type": "civitai",
"civit_url": "<string>"
},
"private": true,
"description": ""
}
'import requests
url = "https://api.deepinfra.com/v1/lora/create"
payload = {
"base_model": "<string>",
"lora_name": "<string>",
"source": {
"type": "civitai",
"civit_url": "<string>"
},
"private": True,
"description": ""
}
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({
base_model: '<string>',
lora_name: '<string>',
source: {type: 'civitai', civit_url: '<string>'},
private: true,
description: ''
})
};
fetch('https://api.deepinfra.com/v1/lora/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.deepinfra.com/v1/lora/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([
'base_model' => '<string>',
'lora_name' => '<string>',
'source' => [
'type' => 'civitai',
'civit_url' => '<string>'
],
'private' => true,
'description' => ''
]),
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.deepinfra.com/v1/lora/create"
payload := strings.NewReader("{\n \"base_model\": \"<string>\",\n \"lora_name\": \"<string>\",\n \"source\": {\n \"type\": \"civitai\",\n \"civit_url\": \"<string>\"\n },\n \"private\": true,\n \"description\": \"\"\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.deepinfra.com/v1/lora/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_model\": \"<string>\",\n \"lora_name\": \"<string>\",\n \"source\": {\n \"type\": \"civitai\",\n \"civit_url\": \"<string>\"\n },\n \"private\": true,\n \"description\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepinfra.com/v1/lora/create")
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 \"base_model\": \"<string>\",\n \"lora_name\": \"<string>\",\n \"source\": {\n \"type\": \"civitai\",\n \"civit_url\": \"<string>\"\n },\n \"private\": true,\n \"description\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"deploy_id": "fkj843kjh8",
"model_name": "google/vit-base-patch16-224",
"version": "d8b79b422843bd59d628bf25b01aded94a9ec1a9b917e69fe460df9ff39ec42b",
"task": "image-classification",
"status": "deployed",
"fail_reason": "Initialization failed",
"created_at": "2021-08-27T17:19:21+00:00",
"updated_at": "2021-08-27T17:19:21+00:00",
"type": "legacy",
"instances": {
"running": 123,
"pending": 123,
"warming": 0
},
"config": {
"gpu": "L4-24GB",
"num_gpus": 123,
"max_batch_size": 123,
"weights": {
"repo": "<string>",
"revision": "<string>",
"token": "<string>"
}
},
"settings": {
"min_instances": 1,
"max_instances": 1
},
"standard_args": {
"max_context_size": 5000000,
"max_concurrent_requests": 512,
"max_images_per_prompt": 512,
"gpu_memory_fraction": 0.735,
"max_prefill_tokens": 65792,
"kv_cache_dtype": "auto",
"enable_prefix_caching": true,
"quantization": "fp8"
},
"extra_args": [
"<string>"
],
"update_error": "<string>",
"rollout": {
"up_to_date": 123,
"outdated": 123,
"booting": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}LoRA Adapters
Create Lora
POST
/
v1
/
lora
/
create
Create Lora
curl --request POST \
--url https://api.deepinfra.com/v1/lora/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base_model": "<string>",
"lora_name": "<string>",
"source": {
"type": "civitai",
"civit_url": "<string>"
},
"private": true,
"description": ""
}
'import requests
url = "https://api.deepinfra.com/v1/lora/create"
payload = {
"base_model": "<string>",
"lora_name": "<string>",
"source": {
"type": "civitai",
"civit_url": "<string>"
},
"private": True,
"description": ""
}
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({
base_model: '<string>',
lora_name: '<string>',
source: {type: 'civitai', civit_url: '<string>'},
private: true,
description: ''
})
};
fetch('https://api.deepinfra.com/v1/lora/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.deepinfra.com/v1/lora/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([
'base_model' => '<string>',
'lora_name' => '<string>',
'source' => [
'type' => 'civitai',
'civit_url' => '<string>'
],
'private' => true,
'description' => ''
]),
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.deepinfra.com/v1/lora/create"
payload := strings.NewReader("{\n \"base_model\": \"<string>\",\n \"lora_name\": \"<string>\",\n \"source\": {\n \"type\": \"civitai\",\n \"civit_url\": \"<string>\"\n },\n \"private\": true,\n \"description\": \"\"\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.deepinfra.com/v1/lora/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base_model\": \"<string>\",\n \"lora_name\": \"<string>\",\n \"source\": {\n \"type\": \"civitai\",\n \"civit_url\": \"<string>\"\n },\n \"private\": true,\n \"description\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepinfra.com/v1/lora/create")
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 \"base_model\": \"<string>\",\n \"lora_name\": \"<string>\",\n \"source\": {\n \"type\": \"civitai\",\n \"civit_url\": \"<string>\"\n },\n \"private\": true,\n \"description\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"deploy_id": "fkj843kjh8",
"model_name": "google/vit-base-patch16-224",
"version": "d8b79b422843bd59d628bf25b01aded94a9ec1a9b917e69fe460df9ff39ec42b",
"task": "image-classification",
"status": "deployed",
"fail_reason": "Initialization failed",
"created_at": "2021-08-27T17:19:21+00:00",
"updated_at": "2021-08-27T17:19:21+00:00",
"type": "legacy",
"instances": {
"running": 123,
"pending": 123,
"warming": 0
},
"config": {
"gpu": "L4-24GB",
"num_gpus": 123,
"max_batch_size": 123,
"weights": {
"repo": "<string>",
"revision": "<string>",
"token": "<string>"
}
},
"settings": {
"min_instances": 1,
"max_instances": 1
},
"standard_args": {
"max_context_size": 5000000,
"max_concurrent_requests": 512,
"max_images_per_prompt": 512,
"gpu_memory_fraction": 0.735,
"max_prefill_tokens": 65792,
"kv_cache_dtype": "auto",
"enable_prefix_caching": true,
"quantization": "fp8"
},
"extra_args": [
"<string>"
],
"update_error": "<string>",
"rollout": {
"up_to_date": 123,
"outdated": 123,
"booting": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}When called with an API key, the key needs the
lora scope (about scopes).Authorizations
Body
application/json
Response
Successful Response