Sigo sar te startis
Ker tuthi angluni keripe jekhe cikne minutenca. Sa 1,496 modelo len jekhfalo mangipen thaj den palpale jekh mangipnasqo objektos, vaš kipo, video thaj audio: sikľuv les jekhvar kate.
1. Len jekh API klidin
Ker jekh klidin ko https://doitong.com/developers/dashboard#keys thaj garav les andre jekh
environment variable: sikavel pes numa jekhvar. Sako klidin šaj te lel pesqo budžeto, vašoda šaj les te des jekhe agentoske
bizo te riskines sa o khonto. GET /account sikavel tutho API balanso.
export DOITONG_API_KEY="doitong_..."
curl "https://api.doitong.com/v1/account" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const res = await fetch("https://api.doitong.com/v1/account", {
headers: { Authorization: `Bearer ${process.env.DOITONG_API_KEY}` },
});
console.log(await res.json());
import os
import requests
r = requests.get(
"https://api.doitong.com/v1/account",
headers={"Authorization": f"Bearer {os.environ['DOITONG_API_KEY']}"},
)
print(r.json())
O keripena pes pokinen andar tutho kontosqo API balanso andre API krediti: 1,000 API krediti = $1, thaj sako modelo kostet precizno lesqe kerimasqo gindipen. Pher tutho balanso ko https://doitong.com/developers/dashboard#balance.
2. Gin, palem ker
POST /quote/{model_id} lel o inputo JSON thaj del tut precizno mol. Na mangel klidin thaj na kostet nič. O keripe
sagda inputosqo kostet akor: o gindipen si o pokin. (Jekh modelo, savo pokinel palem labaripen, si o jekh wyjątko: lesqo
gindipen si o barvalipen so o keripe šaj te kostet, thaj o na-labardo kotor irinel pes palal o keripe.)
curl -X POST "https://api.doitong.com/v1/quote/kling-video/v3/pro/image-to-video" \
-H "Content-Type: application/json" \
-d '{"image": "https://example.com/fox.jpg", "duration": 5, "generate_audio": true}'
const res = await fetch("https://api.doitong.com/v1/quote/kling-video/v3/pro/image-to-video", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ image: "https://example.com/fox.jpg", duration: 5, generate_audio: true }),
});
const quote = await res.json();
console.log(quote.credits, quote.usd); // 840 "0.84"
import requests
r = requests.post(
"https://api.doitong.com/v1/quote/kling-video/v3/pro/image-to-video",
json={"image": "https://example.com/fox.jpg", "duration": 5, "generate_audio": True},
)
print(r.json()["credits"], r.json()["usd"]) # 840 0.84
{
"object": "quote",
"model": "kling-video/v3/pro/image-to-video",
"credits": 840,
"usd": "0.84",
"unit": "second",
"quantity": 5,
"unit_credits": 168,
"mode": "exact",
"breakdown": "5 s × 168 API credits"
}
Palem bičhal tuti jekhfalo body ko POST /run/{model_id}. Thov ?wait=20 te garaves o konekcia vaj ko 20 sekunda: jekh sigo
modelo del o agorutno rezultato andre jekh round trip. Bičhal jekh Idempotency-Key header, te retry na kerel (vaj na pokinel)
dujvar.
curl -X POST "https://api.doitong.com/v1/run/flux/schnell?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: lighthouse-001" \
-d '{"prompt": "A lighthouse on a rocky coast at dusk, warm light in the window"}'
const res = await fetch("https://api.doitong.com/v1/run/flux/schnell?wait=20", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DOITONG_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "lighthouse-001",
},
body: JSON.stringify({ prompt: "A lighthouse on a rocky coast at dusk, warm light in the window" }),
});
const request = await res.json();
console.log(request.status, request.outputs[0]?.url);
import os
import requests
r = requests.post(
"https://api.doitong.com/v1/run/flux/schnell",
params={"wait": 20},
headers={
"Authorization": f"Bearer {os.environ['DOITONG_API_KEY']}",
"Idempotency-Key": "lighthouse-001",
},
json={"prompt": "A lighthouse on a rocky coast at dusk, warm light in the window"},
)
request = r.json()
print(request["status"], request["outputs"][0]["url"] if request["outputs"] else None)
O odpoveda si jekh mangipnasqo objektos:
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "flux/schnell",
"status": "succeeded",
"cost": { "credits": 3, "usd": "0.003", "charged": 3, "refunded": 0 },
"outputs": [
{ "type": "image", "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg", "width": 1024, "height": 768, "stored": true }
],
"error": null
}
3. Dikh o status
Te o modelo ajci kerel buti kana agoril o vakti, les tut 202 Accepted le mangipnasqe id thaj lesqo akto
status. Sako mangipen džal tele jekhfalo lifecycle:
-
queuedLelilo thaj plaćime, azhukerel bućakoro -
runningO modelo kerel -
Palune statusura:
succeededPokinime o citato; outputs[] si len URL-e amare arkhivoskefailedVracime automatikane; o error phenel soskecanceledAčhilo angle rezultatestar; vracime
Gin palem o mangipen lesqe idesa. ?wait=20 kerel buti vi kate, vašoda jekh sasto loop si dosta:
curl "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const headers = { Authorization: `Bearer ${process.env.DOITONG_API_KEY}` };
let request = await (await fetch("https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t?wait=20", { headers })).json();
while (request.status === "queued" || request.status === "running") {
const res = await fetch(`https://api.doitong.com/v1/requests/${request.id}?wait=20`, { headers });
request = await res.json();
}
console.log(request.status, request.outputs[0]?.url);
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['DOITONG_API_KEY']}"}
request = {"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t", "status": "queued"}
while request["status"] in ("queued", "running"):
request = requests.get(
f"https://api.doitong.com/v1/requests/{request['id']}",
params={"wait": 20},
headers=headers,
).json()
print(request["status"], request["outputs"][0]["url"] if request["outputs"] else None)
Kana status si succeeded, outputs[].url inkrel linkura ko fajlo amare arakhipnaste. Te o mangipen failed vaj sas
canceled, lesqe API krediti irinen pes avtomaticko thaj error phenel soske. Canceľin sa so ajci si queued vaj
running:
curl -X POST "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel" \
-H "Authorization: Bearer $DOITONG_API_KEY"
Vaš bare video keripena šaj te mukes o polling thaj te bičhalel webhook_url (dikh Webhooks).
4. Fajlo
Bičhal sajekh publike URL sar inputo, vaj mang POST /files vaš jekh upload URL, PUT o fajlo odothe thaj lačhar o palpale
file_url (dikh Files). Jekh mangipen savo agorisardilo sikavel lesqe rezultatura andre outputs[] le
typesa, content typesa thaj, kana džanel pes, dimenzijenca thaj durata.
curl -X POST "https://api.doitong.com/v1/files" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename": "fox.jpg", "content_type": "image/jpeg", "size": 482113}'
Greškipena
Sako modelo našťi kerel jekhfalo: jekh envelope le type, jekhe precizne code, o problematikane param thaj sako problem
andre details, vašoda jekh agento šaj te lačharel o mangipen bizo te ginel proza. Na pokinel pes nič vaš invalidno mangipen.
{
"error": {
"type": "invalid_request",
"code": "invalid_input",
"message": "duration must be one of 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15.",
"param": "duration",
"details": [ { "param": "duration", "message": "duration must be one of 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15." } ],
"request_id": null,
"doc_url": "https://doitong.com/developers/docs/errors#invalid_input"
}
}
Sako type thaj code si listome andre Errors.
Mol
O mola si andre USD thaj API krediti thaj sikaven pes pro sako modelosqi pagina angla tu te keres. Sako mangipen anel cost le
credits, usd, charged thaj refunded. Jekh keripe pokinel pes kana les lel pes; failed thaj canceled mangipena
irinen pes avtomaticko. Važno modelo molin pes precizno pala o inputo, varesave pala o lungipen vaj baripen le fajlengo so tu
bičhales, avera pokinen jekh gindime mol vaš keripe: sar te na avel, o gindipen si so tu pokines. Cikne modelo (čhibake thaj
vision modelo, lavutne, sadhana vaš procesamiento-vakto) pokinena palem labaripen: o gindipen si o barvalipen so o keripe šaj te
kostel, thaj o kotor so o keripe na labardas irinel pes avtomaticko. Dikh Pricing.
MCP thaj AI agento
Konektil sa MCP client ko https://api.doitong.com/v1/mcp le jekhe Bearer klidinesa. Tiro agento šaj te rodavel andro katalogo, te gindil thaj
te kerel modelo, thaj te ginel sako dokumentacia-pagina sar Markdown.
claude mcp add --transport http doitong-models https://api.doitong.com/v1/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
Palune faze
- Dikh sa modelo. Sako pagina si la mangipnasqo builder savo irakarel o kodo vaš tute.
- Sikľuv o mangipnasqo lifecycle: Requests.
- Labar jekhfale parametrengo lava pro sako modelo: Parameters.
- Kerel tuthe buti jekhe AI coding agentosa? De les https://doitong.com/developers/llms.txt vaj konektil o MCP server.