{"openapi":"3.1.0","info":{"title":"LowCostAi API","version":"1.0.0","description":"Generate images, video and audio with named AI models, paid in prepaid credits. Full documentation: https://low-cost.ai/en/docs"},"servers":[{"url":"https://low-cost.ai"}],"externalDocs":{"url":"https://low-cost.ai/en/docs/api"},"tags":[{"name":"Models"},{"name":"Pricing and generation"},{"name":"Jobs"},{"name":"Files and library"},{"name":"Account"},{"name":"API keys"},{"name":"Credit history"},{"name":"Health check"}],"paths":{"/api/v1/models":{"get":{"operationId":"listModels","tags":["Models"],"summary":"List models","description":"Every model available right now, with the price of one generation at its default settings. Open to everyone, no key needed. Use it to pick a model and get its id.\n\nA category that is not one of the four values does not return an error, it returns an empty list.\n\nPrices are recalculated on every call. For the exact price of your settings, call [estimate](/docs/api#estimate).\n\nA retired model, or one that cannot run right now, is left out of the list.","security":[],"parameters":[{"name":"category","in":"query","required":false,"description":"Filter by category. Without it every model comes back","schema":{"type":"string","enum":["video","image","audio","analysis"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"models":[{"id":"kling-3.0","name":"Kling 3.0","category":"video","modes":["text-to-video","image-to-video"],"params":[{"key":"prompt","type":"text","required":true,"label":{"he":"...","en":"..."},"max_length":2500},{"key":"duration","type":"enum","values":[3,4,5,6,7,8,9,10,11,12,13,14,15],"default":5,"label":{"he":"...","en":"..."}},{"key":"aspect_ratio","type":"enum","values":["16:9","9:16","1:1"],"default":"16:9","label":{"he":"...","en":"..."}}],"guide":{"best_for":{"he":"...","en":"..."},"strengths":{"he":["..."],"en":["..."]},"hebrew":{"level":"unknown","what":null,"note":{"he":"...","en":"..."}}},"available":true,"from_credits":12.5,"price_basis":"per_second"}]}}}},"default":{"description":"Error. Possible codes: server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl \"https://low-cost.ai/api/v1/models?category=video\""}]}},"/api/v1/models/{id}":{"get":{"operationId":"getModel","tags":["Models"],"summary":"Get one model and its parameters","description":"Every parameter the model accepts: name, type, allowed values, default, range and maximum length. This is the only way to know what may go into params for a given model.\n\nOnly parameters and values that can run right now are shown. A model's list can therefore change over time, so read it rather than keeping a fixed copy.\n\nAn unknown, retired or hidden model answers 404 with what: model.","security":[],"parameters":[{"name":"id","in":"path","required":true,"description":"The model id, such as kling-3.0 or nano-banana-pro","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"id":"kling-3.0","name":"Kling 3.0","category":"video","modes":["text-to-video","image-to-video"],"params":[{"key":"prompt","type":"text","required":true,"label":{"he":"...","en":"..."},"max_length":2500},{"key":"duration","type":"enum","values":[3,4,5,6,7,8,9,10,11,12,13,14,15],"default":5,"label":{"he":"...","en":"..."}},{"key":"aspect_ratio","type":"enum","values":["16:9","9:16","1:1"],"default":"16:9","label":{"he":"...","en":"..."}}],"guide":{"best_for":{"he":"...","en":"..."},"strengths":{"he":["..."],"en":["..."]},"hebrew":{"level":"unknown","what":null,"note":{"he":"...","en":"..."}}},"available":true,"from_credits":12.5,"price_basis":"per_second"}}}},"default":{"description":"Error. Possible codes: not_found, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl https://low-cost.ai/api/v1/models/kling-3.0"}]}},"/api/v1/estimate":{"post":{"operationId":"estimate","tags":["Pricing and generation"],"summary":"Estimate a price","description":"The exact price in credits for a model and parameters. Free, charges nothing and needs no key. Parameters are checked exactly as in a generation, so an estimate that passes is also a check that the request is valid.\n\nUp to 120 calls a minute per IP address.\n\ngenerate uses the same calculation, so the price is the same unless the daily exchange rate or the model's availability changed between the two calls. That is why generate requires max_credits.\n\nThe Content-Type: application/json header is required. Without it you get invalid_params with param: body.","security":[],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"model":"kling-3.0","credits":12.5,"params":{"prompt":"Tel Aviv street after rain","duration":5,"aspect_ratio":"9:16"}}}}},"default":{"description":"Error. Possible codes: invalid_params, not_found, rate_limited, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST https://low-cost.ai/api/v1/estimate \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"kling-3.0\",\"params\":{\"prompt\":\"Tel Aviv street after rain\",\"duration\":5,\"aspect_ratio\":\"9:16\"}}'"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model"],"properties":{"model":{"type":"string","description":"The model id"},"params":{"type":"object","default":{},"additionalProperties":true,"description":"The model parameters, as listed by [get model](/docs/api#get-model)"},"variants":{"type":"array","description":"A list of partial parameter sets. Each is laid over params and priced on its own. Only the first 24 are used"}}}}}}}},"/api/v1/generate":{"post":{"operationId":"generate","tags":["Pricing and generation"],"summary":"Generate","description":"Charges the price and starts a job, that is one generation running in the background. The answer comes back at once with the job id, and you get the result by reading [the job](/docs/api#get-job) until it finishes.\n\nThe request is not idempotent: there is no idempotency key, and sending the same request again creates a second job and a second charge. After a network error, first check the [job list](/docs/api#list-jobs) to see whether the job was already created.\n\nThe charge and the job are created together: there is never a job without payment or a payment without a job. A job that fails refunds its credits automatically.\n\nUp to 30 generations a minute per account, shared by the API and the MCP generate tool.\n\nRight after creation status is queued, or running if sending to the model already started, and files is empty.\n\nSpends credits.","security":[{"apiKey":[]}],"parameters":[],"responses":{"201":{"description":"Success","content":{"application/json":{"example":{"id":"6f1c2e0a-1b2c-4d5e-8f90-123456789abc","model_id":"kling-3.0","params":{"prompt":"Tel Aviv street after rain","duration":5,"aspect_ratio":"9:16"},"status":"queued","credits":12.5,"error":null,"refunded":false,"files":[],"source":"api","created_at":"2026-11-23T17:00:00.000Z","finished_at":null}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, rate_limited, invalid_params, not_found, price_above_cap, insufficient_credits, storage_payment_required, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST https://low-cost.ai/api/v1/generate \\\n  -H \"Authorization: Bearer $LCA_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\":\"kling-3.0\",\"params\":{\"prompt\":\"Tel Aviv street after rain\",\"duration\":5,\"aspect_ratio\":\"9:16\"},\"max_credits\":12.5}'"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","max_credits"],"properties":{"model":{"type":"string","description":"The model id"},"params":{"type":"object","default":{},"additionalProperties":true,"description":"The model parameters. An unknown key is refused"},"max_credits":{"type":"number","description":"The most you agree to pay. Must be a positive number. If the actual price is higher, the request is refused and nothing is charged. Send the price you got from estimate"},"source":{"type":"string","enum":["cli","mcp"],"description":"A tag stored on the job. Any other value is stored as api. A website session is always web"}}}}}}}},"/api/v1/jobs":{"get":{"operationId":"listJobs","tags":["Jobs"],"summary":"List jobs","description":"Your jobs, newest first, with file links. Before the list comes back, up to 10 open jobs are moved forward, so the call itself also updates their status.\n\nThere is no next-page token: pass the created_at of the last item in before. Two jobs with exactly the same created_at can be skipped at a page boundary.\n\nA before that is not a valid date returns invalid_params with param: before.","security":[{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many jobs to return. A value out of range is clamped, a value that is not a number becomes 50","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"before","in":"query","required":false,"description":"Cursor for the next page: the created_at of the last job you saw (ISO 8601). Only jobs created before it come back","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"jobs":[{"id":"6f1c2e0a-1b2c-4d5e-8f90-123456789abc","model_id":"kling-3.0","params":{"prompt":"Tel Aviv street after rain","duration":5,"aspect_ratio":"9:16"},"status":"succeeded","credits":12.5,"error":null,"refunded":false,"files":[{"id":"0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90","mime":"video/mp4","bytes":5242880,"created_at":"2026-11-23T17:01:10.000Z","url":"https://low-cost.ai/f/0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90?t=<signature>&e=<day>"}],"source":"api","created_at":"2026-11-23T17:00:00.000Z","finished_at":"2026-11-23T17:01:10.000Z"}]}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, invalid_params, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl \"https://low-cost.ai/api/v1/jobs?limit=20\" -H \"Authorization: Bearer $LCA_KEY\""}]}},"/api/v1/jobs/{id}":{"get":{"operationId":"getJob","tags":["Jobs"],"summary":"Get one job","description":"A job's status, file links once it is ready, and for a succeeded analysis job its report too. This is the call you repeat until the job finishes, and each call also moves the job forward.\n\nCheck every 5 seconds or slower. The server asks the model at most once every 5 seconds per job, so faster checks do not speed anything up.\n\nStop when status is succeeded or failed. A job never stays open for more than two hours.\n\nAnother user's job returns not_found, the same as an id that does not exist.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The job id returned by generate","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"id":"6f1c2e0a-1b2c-4d5e-8f90-123456789abc","model_id":"kling-3.0","params":{"prompt":"Tel Aviv street after rain","duration":5,"aspect_ratio":"9:16"},"status":"succeeded","credits":12.5,"error":null,"refunded":false,"files":[{"id":"0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90","mime":"video/mp4","bytes":5242880,"created_at":"2026-11-23T17:01:10.000Z","url":"https://low-cost.ai/f/0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90?t=<signature>&e=<day>"}],"source":"api","created_at":"2026-11-23T17:00:00.000Z","finished_at":"2026-11-23T17:01:10.000Z"}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, not_found, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl https://low-cost.ai/api/v1/jobs/6f1c2e0a-1b2c-4d5e-8f90-123456789abc -H \"Authorization: Bearer $LCA_KEY\""}]}},"/api/v1/files":{"get":{"operationId":"listFiles","tags":["Files and library"],"summary":"List library files","description":"All your files, both uploads and generated outputs, newest first, together with your storage use.\n\nThe order is by created_at and then id, newest first.","security":[{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many files to return","schema":{"type":"integer","minimum":1,"maximum":200,"default":60}},{"name":"before","in":"query","required":false,"description":"Cursor for the next page: the created_at of the last file you saw","schema":{"type":"string"}},{"name":"before_id","in":"query","required":false,"description":"The id of the last file you saw. Send it with before, because the files of one job share a created_at","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"files":[{"id":"0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90","job_id":null,"mime":"image/png","bytes":345678,"created_at":"2026-11-23T16:00:00.000Z","url":"https://low-cost.ai/f/0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90?t=<signature>&e=<day>"}],"storage":{"bytes":345678,"free_bytes":1073741824,"over_bytes":0,"monthly_ils":0,"blocked":false}}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, invalid_params, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl \"https://low-cost.ai/api/v1/files?limit=50\" -H \"Authorization: Bearer $LCA_KEY\""}]},"post":{"operationId":"uploadFile","tags":["Files and library"],"summary":"Upload an input file","description":"Uploads a file from your computer, such as a start frame, a reference image, audio or a video, and returns a link you can pass to a model as a parameter. Models take files only as links, so this is how you use a local file.\n\nThe upload itself is free, but the file counts toward storage: 1 GB free, then {storage} a month per GB.\n\nUp to 60 uploads an hour per account.\n\nAn account that has never added credits is limited to 50 MB and 30 uploaded files, and links to its uploads open only for the account itself.\n\nHere storage_payment_required comes with status 400, not 402 as in generate.\n\nThere is no upload tool in MCP.","security":[{"apiKey":[]}],"parameters":[],"responses":{"201":{"description":"Success","content":{"application/json":{"example":{"id":"0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90","mime":"image/png","bytes":345678,"url":"https://low-cost.ai/f/0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90?t=<signature>&e=<day>"}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, rate_limited, too_large, no_file, unsupported_type, quota_exceeded, storage_payment_required, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl -X POST https://low-cost.ai/api/v1/files \\\n  -H \"Authorization: Bearer $LCA_KEY\" \\\n  -F \"file=@frame.png;type=image/png\""}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"The file, in a field named file. Up to 4 MB. Types: image/png, image/jpeg, image/webp, image/gif, video/mp4, video/webm, video/quicktime, audio/mpeg, audio/wav, audio/x-wav, audio/ogg, audio/mp4, audio/flac. The start of the file must match the declared type"}}}}}}}},"/api/v1/files/{id}":{"delete":{"operationId":"deleteFile","tags":["Files and library"],"summary":"Delete a file","description":"Permanently deletes one file from the library and from storage. Works on output files too: the job stays, and the file leaves its files list.\n\nA delete cannot be undone.\n\nIf the account is held for storage fees, the delete re-checks the charge at once and the hold can lift.\n\nDo not delete an input file that an open job is still using: nothing guards against it.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The file id","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"ok":true}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, not_found, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl -X DELETE https://low-cost.ai/api/v1/files/0b6d4f2e-7a1c-4e3b-9d8f-2c5a6b7e8f90 -H \"Authorization: Bearer $LCA_KEY\""}]}},"/api/v1/me":{"get":{"operationId":"getMe","tags":["Account"],"summary":"Get account and balance","description":"Account details, credit balance and storage use. The way to check your balance before a generation.\n\nAdding credits happens only on the website, on the [credits page](/credits). There is no API endpoint for it.","security":[{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"id":"3c9e1a52-8b4d-4f7e-a1c2-5d6e7f8091ab","email":"user@example.com","name":"","lang":"he","theme":"graphite","is_admin":false,"balance_cc":10000,"credits":100,"created_at":"2026-11-01T10:00:00.000Z","storage":{"bytes":345678,"free_bytes":1073741824,"over_bytes":0,"monthly_ils":0,"blocked":false}}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl https://low-cost.ai/api/v1/me -H \"Authorization: Bearer $LCA_KEY\""}]},"patch":{"operationId":"updateMe","tags":["Account"],"summary":"Update account details","description":"Changes the display name, interface language or colour theme. Send only the fields you want to change.\n\nThis is the only account change an API key is allowed to make.","security":[{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"id":"3c9e1a52-8b4d-4f7e-a1c2-5d6e7f8091ab","email":"user@example.com","name":"Dana","lang":"en","theme":"graphite","is_admin":false,"balance_cc":10000,"credits":100,"created_at":"2026-11-01T10:00:00.000Z","storage":{"bytes":345678,"free_bytes":1073741824,"over_bytes":0,"monthly_ils":0,"blocked":false}}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, invalid_params, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl -X PATCH https://low-cost.ai/api/v1/me \\\n  -H \"Authorization: Bearer $LCA_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Dana\",\"lang\":\"en\"}'"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"name":{"type":"string","maxLength":80,"description":"Display name. Trimmed, and cut at 80 characters"},"lang":{"type":"string","enum":["he","en"],"description":"Interface language"},"theme":{"type":"string","enum":["graphite","midnight","board","fog","paper","porcelain","linen","dawn"],"description":"The website colour theme"}}}}}}},"delete":{"operationId":"deleteMe","tags":["Account"],"summary":"Delete the account","description":"Permanently deletes the account and every file. Available only from the signed-in website, not with an API key, so a leaked key cannot erase an account.\n\nCannot be undone. Every file, key, job and history row is removed.\n\nRefused with payment_pending while a top-up page opened in the last 48 hours is still pending.\n\nUp to 10 tries an hour, shared with the password change.","security":[{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"ok":true}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, web_session_required, invalid_params, confirm_email_mismatch, rate_limited, wrong_password, payment_pending, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"# Deleting the account works only from a signed-in website session, not with an API key.\n# Do it on https://low-cost.ai/developers or https://low-cost.ai/settings"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["confirm_email","current_password"],"properties":{"confirm_email":{"type":"string","description":"The account email, as confirmation"},"current_password":{"type":"string","description":"The account password"}}}}}}}},"/api/v1/me/password":{"post":{"operationId":"changePassword","tags":["Account"],"summary":"Change the password","description":"Changes the password and signs out every other website session. Website only. API keys are not affected.\n\nUp to 10 tries an hour.","security":[{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"ok":true,"sessions_ended":2}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, web_session_required, invalid_params, rate_limited, wrong_password, weak_password, password_too_long, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"# Changing the password works only from a signed-in website session, not with an API key.\n# Do it on https://low-cost.ai/developers or https://low-cost.ai/settings"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["current_password","new_password"],"properties":{"current_password":{"type":"string","description":"The current password"},"new_password":{"type":"string","description":"The new password: at least 10 characters, not one repeated character and not a common password"}}}}}}}},"/api/v1/me/sessions":{"delete":{"operationId":"endOtherSessions","tags":["Account"],"summary":"Sign out other sessions","description":"Signs out every website session except the one making the request. Website only.\n\nAPI keys stay active. Revoke them one by one on the [developers page](/developers).","security":[{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"ok":true,"sessions_ended":3}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, web_session_required, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"# Signing out other sessions works only from a signed-in website session, not with an API key.\n# Do it on https://low-cost.ai/developers or https://low-cost.ai/settings"}]}},"/api/v1/keys":{"get":{"operationId":"listKeys","tags":["API keys"],"summary":"List API keys","description":"The account's active keys, newest first. The key itself is never returned, only its first 10 characters.","security":[{"apiKey":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"keys":[{"id":"9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","prefix":"lca_AbCdEf","name":"Work laptop","created_at":"2026-11-20T10:00:00.000Z","last_used_at":null}]}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl https://low-cost.ai/api/v1/keys -H \"Authorization: Bearer $LCA_KEY\""}]},"post":{"operationId":"createKey","tags":["API keys"],"summary":"Create an API key","description":"Creates a new API key and returns it only once. Website only, on the [developers page](/developers): a key cannot create keys, so a leaked key cannot spread itself.\n\nUp to 25 active keys per account, and up to 20 new keys an hour.","security":[{"apiKey":[]}],"parameters":[],"responses":{"201":{"description":"Success","content":{"application/json":{"example":{"id":"9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","key":"lca_<32 characters>"}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, web_session_required, rate_limited, too_many_keys, invalid_params, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"# Creating a key works only from a signed-in website session, not with an API key.\n# Do it on https://low-cost.ai/developers or https://low-cost.ai/settings"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"name":{"type":"string","maxLength":60,"default":"","description":"A name to recognise the key, for example after the computer or tool. Cut at 60 characters"}}}}}}}},"/api/v1/keys/{id}":{"delete":{"operationId":"revokeKey","tags":["API keys"],"summary":"Revoke an API key","description":"Revokes a key at once. Every tool that uses it, an app connected with OAuth included, stops working. Website only.\n\nA revoked key cannot be restored. Revoking a key that is already revoked returns 404.","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The key id from the key list","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"ok":true}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, bad_origin, web_session_required, not_found, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"# Revoking a key works only from a signed-in website session, not with an API key.\n# Do it on https://low-cost.ai/developers or https://low-cost.ai/settings"}]}},"/api/v1/ledger":{"get":{"operationId":"listLedger","tags":["Credit history"],"summary":"List credit history","description":"Every balance movement, newest first: charges, refunds, top-ups, storage fees and grants. This is how you reconcile jobs with charges.","security":[{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many rows to return","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"before","in":"query","required":false,"description":"Cursor for the next page: the id of the last row you saw, a number of up to 18 digits","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"ledger":[{"id":1235,"kind":"refund","ref":"6f1c2e0a-1b2c-4d5e-8f90-123456789abc","note":"refund","created_at":"2026-11-23T17:20:00.000Z","delta_credits":12.5},{"id":1234,"kind":"charge","ref":"6f1c2e0a-1b2c-4d5e-8f90-123456789abc","note":"Kling 3.0","created_at":"2026-11-23T17:00:00.000Z","delta_credits":-12.5}]}}}},"default":{"description":"Error. Possible codes: unauthorized, account_blocked, invalid_params, server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-codeSamples":[{"lang":"curl","source":"curl \"https://low-cost.ai/api/v1/ledger?limit=100\" -H \"Authorization: Bearer $LCA_KEY\""}]}},"/api/health":{"get":{"operationId":"healthCheck","tags":["Health check"],"summary":"Health check","description":"Whether the service and its database answer. Meant for monitoring tools. Open to everyone, no key needed.\n\nThe answer is kept for up to 60 seconds on each server, so checking more often returns the same answer. The address is not under /api/v1.","security":[],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"ok":true,"db_ms":42,"demo":false}}}}},"x-codeSamples":[{"lang":"curl","source":"curl https://low-cost.ai/api/health"}]}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An lca_ API key from the developers page"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["unauthorized","account_blocked","bad_origin","web_session_required","rate_limited","invalid_params","not_found","insufficient_credits","storage_payment_required","price_above_cap","server_error","too_many_keys","too_large","no_file","unsupported_type","quota_exceeded","confirm_email_mismatch","wrong_password","weak_password","password_too_long","payment_pending","generation_failed","invalid_client","invalid_request","invalid_grant","invalid_target","unsupported_grant_type","unsupported_response_type","invalid_redirect_uri","invalid_client_metadata","access_denied"]}},"additionalProperties":true}}}}