B2BB2B LLM

Editing company images

Multipart image edits with private operation results.

Edit a company image

Use POST /v1/images/edits only with a reviewed image.edit route. Submit multipart fields model, prompt, optional supported scalar options, and image or repeated image[] parts. Do not mix the two image field forms. A single mask is accepted only when the route permits it; required status, MIME, size, same-dimension and alpha requirements come from that reviewed contract.

Keep a stable Idempotency-Key for this operation. The gateway decodes actual image bytes, ignores the client filename and MIME as evidence, and validates the route's image count and size limits. PNG, JPEG and static WebP are the runtime formats; animated inputs are rejected. The default runtime ceilings are 16 MiB per image, 32 MiB of combined input and 16 million pixels per image, reduced further by route policy and configured request limits.

For background processing, add a multipart model_gate field containing {"async":true}. Company credentials stay in the Authorization header, never in multipart fields. The submitted files and resulting images are private to the operation's owner/principal/key/group scope. Use the operation ID, not another edit POST, to recover an interrupted client connection.

Pin a route in multipart

Select a public 26-character route_id from GET /v1/images/catalog?model=YOUR_MODEL&operation=image.edit. In create requests, the route pin belongs inside the JSON string in the single multipart field model_gate. A separate multipart field named route_id, model_gate.route_id or model_gate[route_id] is rejected with HTTP 400 unsupported_parameter. Never send the route ID as an HTTP header or a query parameter.

curl https://api.b2b-llm.com/v1/images/edits \
  -H "Authorization: Bearer $B2B_API_KEY" \
  -H 'Idempotency-Key: image-edit-001' \
  -F 'model=YOUR_MODEL' \
  -F 'prompt=Keep the original composition' \
  -F 'size=auto' \
  -F 'image=@./source.png;type=image/png' \
  -F 'model_gate={"route_id":"YOUR_ROUTE_PUBLIC_ID","async":true}'

Replace YOUR_ROUTE_PUBLIC_ID with the actual public offer ID, and YOUR_MODEL with the offered model. The requested size=auto is illustrative, not a universal requirement: only use values allowed by that route's current image.edit contract. A route can enforce transport.size=auto when forwarding to its supplier; accepted request parameters do not guarantee exact output pixel dimensions or aspect ratio. Inspect the returned image. A fixed-size request must not be assumed to imply a fixed-size result.

Do not copy the quote payload into multipart: POST /v1/images/quote instead accepts top-level JSON route_id and normalized file descriptors; no image files are uploaded there. The route pin in the example selects only that eligible offer; if the route is disabled, inaccessible or incompatible, create returns HTTP 422 image_route_not_available with error.param=model_gate.route_id before paid dispatch. Omitting the pin allows selection among eligible routes, so two submissions can use different suppliers.

Follow company operation handling for polling, expiry and download-only retries. The company balance is settled through the existing accounting path, not a second image-specific wallet.

The Playground Images tab can serialize real multipart editing without exposing permanent API secrets. Optional model_gate.quote_sha256 binds a previous unpaid quote; input metadata used by a quote never substitutes actual file validation.

In company operation details and history, quoted amounts remain explicitly labelled until measured accounting is recorded. Calculated cost does not by itself confirm company settlement. An empty file list during processing is not an expired download. For the separate aggregate-only usage representation and price labels, see image result fields.

Image request errors

Errors contain a stable error.code, human-readable error.message, error.type and, where applicable, error.param. Keep X-Request-ID from the response for support; never send the API key. Unknown canonical model and alias return 400 model_not_found, not a catalog outage.

HTTPCodeAction
400model_not_foundCheck model ID or alias.
400unsupported_parameter / unsupported_value / incompatible_parametersCorrect the indicated parameter using that route's contract; allowed values may be provided.
422image_route_not_availableCheck or remove the explicit route_id.
503image_route_unavailableNo reviewed route is currently available; contact support.
503image_configuration_unavailableRoute configuration/pricing is unavailable; contact support.
503image_catalog_unavailableThe catalog backend failed.

Restrictions of several routes are not merged into fictitious accepted combinations. Do not automatically repeat a paid POST after a timeout or ambiguous failure. Check operation status and keep the original idempotency key. Detailed internal configuration/credential errors are not returned to clients.