Edit an image
const url = 'https://api.katara.com/v1/images/edits';const form = new FormData();form.append('model', 'katara/cortex');form.append('prompt', 'example');form.append('image', 'file');form.append('previous_edit_id', 'example');form.append('size', '1536x1024');form.append('image_size', '1K');form.append('aspect_ratio', '1:1');form.append('n', '1');form.append('response_format', 'b64_json');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.katara.com/v1/images/edits \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form model=katara/cortex \ --form prompt=example \ --form image=@file \ --form previous_edit_id=example \ --form size=1536x1024 \ --form image_size=1K \ --form aspect_ratio=1:1 \ --form n=1 \ --form response_format=b64_jsonChanges a picture by an instruction, optionally with reference pictures. Any model name is
served by Katara Cortex, which edits with the main image model. One image per request, returned as base64. The price is
the model’s per-image price for the size made, plus input_image_price for each picture
sent, and is charged only when an image comes back. A reply carries katara.edit_id; send
it as previous_edit_id to keep editing the same picture without sending it again. The id
lasts 7 days and works only for the account or wallet that paid for the turn.
Pictures are PNG, JPEG or WebP, at most 7 MB each and 11 in all (the one edited and 10
references); the request body is at most 19 MB. Links and file ids are not fetched, and
there is no mask. Every image carries an invisible watermark.
Authorizations
Section titled “Authorizations”- bearerAuth
- None
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Without a key, base64 of the x402 payment payload that signs the quote from a previous 402.
The same payload under the header name of the first x402 version, paid with exact.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
katara/cortexThe picture to edit. Send several as image[]; the first is edited, the rest are references.
Example
1536x1024object
object
A data URL.
Example
{ "model": "katara/cortex", "prompt": "Change the robots to rabbits", "image": "data:image/png;base64,iVBORw0KGgo..."}Responses
Section titled “Responses”The edited image, in the same shape as a generated one.
object
object
The image, base64-encoded.
object
The images charged for.
object
What this reply cost.
object
The settled price, in USDC, as a decimal string. For a request paid with x402 it is the charge, the model’s minimum included (0.025 USDC, 0.05 for katara/cortex-genius, 0.01 for katara/cortex-smart).
The Credits charge as a decimal string. This legacy field name is retained for compatibility; display Credits without a dollar sign.
On a request paid with x402, the payment that settles the reply.
object
The token paid.
The charge in the token’s base units, the same as amount in PAYMENT-RESPONSE.
The provider’s address, or managed when a vendor answered.
Prompt tokens the vendor read from its cache, billed at the cached input rate.
What the cached tokens saved against the input rate, in USDC.
The same saving in Credits, on a reply paid with account credits.
When katara.compaction summarised the conversation.
object
The system message to send in place of the summarised messages.
object
First index in this request’s messages that the summary replaces.
First index kept after it.
The summary request’s usage and its cost (cost_usdc or cost_usd).
object
Why no summary was made; the request went whole.
object
Tokens this request wrote to a new explicit cache (katara.cache).
How long that cache is kept.
What keeping it costs, in USDC; included in cost_usdc.
On Test, a reply with fixed text that no model wrote, served when no Test provider was free.
The stop sequence at which Katara ended the reply.
The searches this request was charged for.
object
The successful searches; only those are charged, and none when the request ended without an answer.
On a web search request, how many model calls it made.
Every search the model made, in order. Not on stream chunks, which carry each search as it runs.
object
object
On an image reply from a model that edits, the id to send as previous_edit_id.
What this reply cost.
object
The settled price, in USDC, as a decimal string. For a request paid with x402 it is the charge, the model’s minimum included (0.025 USDC, 0.05 for katara/cortex-genius, 0.01 for katara/cortex-smart).
The Credits charge as a decimal string. This legacy field name is retained for compatibility; display Credits without a dollar sign.
On a request paid with x402, the payment that settles the reply.
object
The token paid.
The charge in the token’s base units, the same as amount in PAYMENT-RESPONSE.
The provider’s address, or managed when a vendor answered.
Prompt tokens the vendor read from its cache, billed at the cached input rate.
What the cached tokens saved against the input rate, in USDC.
The same saving in Credits, on a reply paid with account credits.
When katara.compaction summarised the conversation.
object
The system message to send in place of the summarised messages.
object
First index in this request’s messages that the summary replaces.
First index kept after it.
The summary request’s usage and its cost (cost_usdc or cost_usd).
object
Why no summary was made; the request went whole.
object
Tokens this request wrote to a new explicit cache (katara.cache).
How long that cache is kept.
What keeping it costs, in USDC; included in cost_usdc.
On Test, a reply with fixed text that no model wrote, served when no Test provider was free.
The stop sequence at which Katara ended the reply.
The searches this request was charged for.
object
The successful searches; only those are charged, and none when the request ended without an answer.
On a web search request, how many model calls it made.
Every search the model made, in order. Not on stream chunks, which carry each search as it runs.
object
object
On an image reply from a model that edits, the id to send as previous_edit_id.
From a model that edits: send as previous_edit_id to keep editing this picture.
Example
{ "output_format": "png", "katara": { "cost_usdc": "0.000018", "cost_usd": "0.000018", "billing_method": "credits", "payment": { "scheme": "upto", "network": "eip155:43114", "amount": "25000" }, "web_searches": [ { "error": "invalid_input" } ] }}Headers
Section titled “Headers”On a call paid with x402, as for chat completions; amount is the charge.
A malformed request (invalid_request), edit_expired when previous_edit_id is no longer kept or belongs to another payer, too_many_images, image_refused when the provider refused the prompt, or a field the route does not take (unsupported_parameter).
object
object
For people. Wording may change.
Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.
The response’s x-katara-request-id.
Example
{ "error": { "type": "invalid_request_error", "code": "invalid_api_key" }}Unknown key (invalid_api_key).
object
object
For people. Wording may change.
Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.
The response’s x-katara-request-id.
Example
{ "error": { "type": "invalid_request_error", "code": "invalid_api_key" }}Without a key, a quote (with PAYMENT-REQUIRED) or a payment that does not verify (payment_invalid); with a credits key, insufficient_credits.
object
object
For people. Wording may change.
Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.
The response’s x-katara-request-id.
An x402 quote for one request.
object
The ways this request can be paid, for the same maximum. upto entries, where offered, come before exact. Sign one.
object
upto: a Permit2 transfer of at most amount, of which only the charge is pulled. exact: an EIP-3009 transfer of amount, with the difference refunded. Neither collects more than was signed.
The chain as a CAIP-2 id.
The USDC contract the authorization is for.
The most this request can cost, in the token’s base units. At least the model’s minimum: 25000 (0.025 USDC), 50000 for katara/cortex-genius, 10000 for katara/cortex-smart.
The settlement contract; the authorization’s to.
Validity to give the authorization.
object
The token’s EIP-712 domain name.
The token’s EIP-712 domain version.
exact only. The job this quote is bound to. It may be signed as the authorization nonce; a random nonce also works.
The job this quote is bound to.
upto only.
upto only. The address that settles; the signed witness names it.
The address paid for the reply.
The model paid for: katara/cortex-genius or katara/cortex-smart when the request named one, otherwise katara/cortex for a chat, Messages, Responses or image request; the embedding model for embeddings.
katara/cortex for a chat, Messages, Responses or image request, whatever it named; the embedding model for embeddings.
True when a vendor’s model will answer.
eip2612GasSponsoring, when present: the token takes EIP-2612 permits, and a permit for
Permit2 sent with an upto payment is submitted with the settlement at Katara’s cost.
object
Example
{ "error": { "type": "invalid_request_error", "code": "invalid_api_key" }}Headers
Section titled “Headers”Base64 of the PaymentRequired object in the body. Present only on a quote.
The body is over 19 MB (request_too_large).
object
object
For people. Wording may change.
Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.
The response’s x-katara-request-id.
Example
{ "error": { "type": "invalid_request_error", "code": "invalid_api_key" }}The image provider failed. Nothing was charged.
object
object
For people. Wording may change.
Stable. Branch on this. Errors says what each code means and what to do; new codes may be added.
The response’s x-katara-request-id.
Example
{ "error": { "type": "invalid_request_error", "code": "invalid_api_key" }}