Stable Diffusion with LoRAs
I-integrate
lora
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/lora?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/lora?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/lora", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/fil/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.com/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "lora",
"input": {
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
}
Tawagin ang modelong Stable Diffusion with LoRAs (lora) sa pamamagitan ng Doitong API. Dokumentasyon para sa mga agent: https://doitong.com/fil/developers/models/lora.md
POST https://api.doitong.com/v1/run/lora?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
Kung ang response status ay "queued" o "running", i-poll ang GET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20 hanggang maging "succeeded"; nasa outputs[].url ang mga file. Ang POST https://api.doitong.com/v1/quote/lora na may parehong body ay nagbabalik ng eksaktong presyo bago patakbuhin.
Kahilingang ito: ≈$0.057 57 kredito ng API Patakbuhin ito sa page na ito
Ang bago mong API key. Ipinapakita lang ito ngayon at nasa code at sa field ng API key sa ibaba na. Panatilihin itong sikreto: huwag kailanman ilagay sa code na tumatakbo sa browser.
Dito mapupunta ang iyong unang resulta
Bumuo ng kahilingan sa ibaba at patakbuhin ito gamit ang iyong API key. Kinokopya ang mga output sa aming storage, na pinananatili nang walang hanggan o 7 araw nang libre.
Bumuo ng kahilingan
Ang mga control ay binubuo mula sa schema ng modelo. Nagbabago ang code at presyo habang ina-adjust mo ang mga ito.
/run/lora?wait=20
presyo → $0.057
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/lora?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/lora?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/lora", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "lora",
"input": {
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"wait_seconds": 20
}
}
}
Patakbuhin ang kahilingang ito
Nananatili ang iyong key sa browser na ito: ipinapadala lamang ito sa Doitong API at sine-save (localStorage) lamang kung pipiliin mo ang Tandaan. Kumuha ng API key
Tungkol sa Stable Diffusion with LoRAs
Gumagawa ng mga larawan mula sa teksto prompt gamit ang base modelo na ibinigay sa pamamagitan ng URL o HuggingFace ID sa `model_name`. Maaaring pagsamahin ang ilang `loras`, at sinusuportahan ang embeddings, ControlNets, IP adapters at IC Light input. Kasama sa mga opsyon ng sampler ang maraming scheduler at hakbang mula 1 hanggang 150. Gumagawa ng 1 hanggang 8 larawan sa png o jpeg.
Mga parameter
Ipadala ang canonical na pangalan o ang native na pangalan, hindi pareho. Mga canonical na pangalan
model_namekinakailangan
unet_nameopsyonal
variantopsyonal
promptkinakailangan
negative_promptopsyonal
prompt_weightingopsyonal
lorasopsyonal
loras[].pathkinakailangan
loras[].scaleopsyonal
embeddingsopsyonal
embeddings[].pathkinakailangan
embeddings[].tokensopsyonal
controlnetsopsyonal
controlnets[].pathkinakailangan
controlnets[].config_urlopsyonal
controlnets[].variantopsyonal
controlnets[].image_urlkinakailangan
controlnets[].mask_urlopsyonal
controlnets[].conditioning_scaleopsyonal
controlnets[].start_percentageopsyonal
controlnets[].end_percentageopsyonal
controlnets[].ip_adapter_indexopsyonal
controlnet_guess_modeopsyonal
ip_adapteropsyonal
ip_adapter[].ip_adapter_image_urlkinakailangan
ip_adapter[].ip_adapter_mask_urlopsyonal
ip_adapter[].pathkinakailangan
ip_adapter[].model_subfolderopsyonal
ip_adapter[].weight_nameopsyonal
ip_adapter[].insight_face_model_pathopsyonal
ip_adapter[].scaleopsyonal
ip_adapter[].scale_jsonopsyonal
ip_adapter[].unconditional_noising_factoropsyonal
ip_adapter[].image_projection_shortcutopsyonal
image_encoder_pathopsyonal
image_encoder_subfolderopsyonal
image_encoder_weight_nameopsyonal
ic_light_model_urlopsyonal
ic_light_model_background_image_urlopsyonal
ic_light_image_urlopsyonal
seedopsyonal
image_sizeopsyonal
num_inference_stepsopsyonal
guidance_scaleopsyonal
clip_skipopsyonal
scheduleropsyonal
timestepsopsyonal
timesteps.methodopsyonal
timesteps.arrayopsyonal
sigmasopsyonal
sigmas.methodopsyonal
sigmas.arrayopsyonal
prediction_typeopsyonal
rescale_betas_snr_zeroopsyonal
image_formatopsyonal
num_imagesopsyonal
num_outputs
enable_safety_checkeropsyonal
tile_widthopsyonal
tile_heightopsyonal
tile_stride_widthopsyonal
tile_stride_heightopsyonal
etaopsyonal
debug_latentsopsyonal
debug_per_pass_latentsopsyonal
Tumatanggap ang mga parameter ng file ng pampublikong https:// URL, data: URI na hanggang 10 MB, o file_url ng isang upload. Mga file
Output
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "lora",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 57,
"usd": "0.057",
"charged": 57,
"refunded": 0
},
"input": {
"model_name": "stabilityai/stable-diffusion-xl-base-1.0",
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"output": {
"images": [
{
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768
}
],
"seed": 42,
"has_nsfw_concepts": [
false
],
"debug_latents": {
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
},
"debug_per_pass_latents": {
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200
}
},
"outputs": [
{
"type": "image",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
Mga field ng output
- images
- array of object {url, content_type, file_name, file_size, width, height}Impormasyon ng file para sa mga nabuong larawan.
- seed
- integerSeed para sa pagbuo ng larawan, kasama ang random na napiling value kung walang seed sa input; kung hindi, inuulit nito ang ibinigay na value.
- has_nsfw_concepts
- array of booleanNagsasaad kung may mga konseptong NSFW sa nabuong mga larawan.
- debug_latents
- object {url, content_type, file_name, file_size} | nullLatent data na naka-store para sa debugging.
- debug_per_pass_latents
- object {url, content_type, file_name, file_size} | nullLatent data sa bawat pass na naka-store para sa debugging.
Iba pang variant ng Stable Diffusion with LoRAs
Higit pang modelo: Text patungong Larawan
Para sa mga AI agent: nasa Markdown ang pahinang ito sa https://doitong.com/fil/developers/models/lora.md. Lahat ng modelo at gabay: https://doitong.com/developers/llms.txt







