Skip to content
Ruvicode logo
Ruvicode
USD

Images

Generate and edit images with the OpenAI-compatible /v1/images endpoints. Priced per image, returned as base64, with an optional 30-day encrypted gallery.

Ruvicode serves image models through two OpenAI-compatible endpoints, on the same API key and wallet as chat:

  • POST /v1/images/generations creates images from a prompt.
  • POST /v1/images/edits changes an image you send, following a prompt.

Images are created at 1K resolution (about one megapixel, for example 1024x1024 or 1248x832). Image models are priced per image, not per token. You pay only for images that come back: a request for 4 images that returns 3 is charged for 3, and a request that fails or is rejected by the content policy costs nothing.

Models

ModelEndpointContent filter
ruvicode-imagegenerationsBlurs adult output
ruvicode-image-uncensoredgenerationsAdult content not blurred
ruvicode-image-editeditsBlurs adult output
ruvicode-image-edit-uncensorededitsAdult content not blurred
ruvicode-image-premiumgenerationsBlurs adult output
ruvicode-image-premium-uncensoredgenerationsAdult content not blurred
ruvicode-image-premium-editeditsBlurs adult output
ruvicode-image-premium-edit-uncensorededitsAdult content not blurred

The premium models give higher-quality images at a higher price per image.

Some content is blurred on every model, the uncensored ones included. The response then carries "blurred": true.

Current prices per image are on each model page in the models catalog and in GET /v1/models (price_per_image). A model that is temporarily unavailable answers 404.

Generate an image

curl https://api.ruvicode.com/v1/images/generations \
  -H "Authorization: Bearer rvcd_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ruvicode-image",
    "prompt": "A lighthouse on a cliff at golden hour",
    "aspect_ratio": "16:9",
    "n": 1,
    "store": false
  }'

With the OpenAI SDK:

import base64
from openai import OpenAI
 
client = OpenAI(api_key="rvcd_...", base_url="https://api.ruvicode.com/v1")
 
result = client.images.generate(
    model="ruvicode-image",
    prompt="A lighthouse on a cliff at golden hour",
    size="1536x1024",
    n=2,
    extra_body={"store": False},  # Ruvicode extension, see the table below
)
for i, image in enumerate(result.data):
    with open(f"image-{i}.png", "wb") as f:
        f.write(base64.b64decode(image.b64_json))

Parameters

ParameterTypeDefaultDescription
modelstringrequiredAn image generation model id
promptstringrequiredWhat to draw, up to 10,000 characters
ninteger1Images to create, 1 to 4
aspect_ratiostring1:11:1, 3:2, 16:9, 21:9, 9:16, 2:3, 3:4, 4:5. Premium models: 1:1, 3:2, 16:9, 9:16, 2:3, 3:4, 4:3
sizestringnoneOpenAI-style size such as 1536x1024. Mapped to the nearest aspect ratio; aspect_ratio wins when you send both
output_formatstringpngpng, jpeg or webp
seedintegerrandomReuse a seed to get similar results for the same prompt
negative_promptstringnoneWhat to keep out of the image
response_formatstringb64_jsonOnly b64_json is supported
storebooleanfalsetrue also saves a copy to your gallery; false returns the image without keeping it

Edit an image

Send one image per request, as a file upload (multipart, as the OpenAI SDKs do) or as base64 in JSON. To keep editing, send the result back as the next request's image.

curl https://api.ruvicode.com/v1/images/edits \
  -H "Authorization: Bearer rvcd_..." \
  -F model="ruvicode-image-edit" \
  -F prompt="Replace the sky with a sunset" \
  -F image=@photo.png \
  -F store=false
result = client.images.edit(
    model="ruvicode-image-edit",
    image=open("photo.png", "rb"),
    prompt="Replace the sky with a sunset",
    extra_body={"store": False},
)

JSON works too: "image" takes a base64 string or a data:image/png;base64,... URI. Image URLs are not accepted.

Parameters

ParameterTypeDefaultDescription
modelstringrequiredAn image edit model id
promptstringrequiredWhat to change, up to 10,000 characters
imagefile or base64requiredOne image: PNG, JPEG or WebP, at least 256x256, up to 20 MB
aspect_ratiostringautoauto keeps the shape of the input, or one of the model's generation ratios
output_formatstringpngpng, jpeg or webp
ninteger1Edits return one image
storebooleanfalsetrue also saves a copy to your gallery (multipart: store=true)

seed and negative_prompt work on generations only. An edit request that sends either is refused with 400 and nothing is charged.

Response

{
  "created": 1792618679,
  "model": "ruvicode-image",
  "data": [
    { "b64_json": "iVBORw0KGgo...", "id": "img_2e2cd91a7a6b18380b8189505e815d5a" }
  ],
  "output_format": "png",
  "cost": 0.03
}
FieldDescription
data[].b64_jsonThe image, base64-encoded
data[].idThe image's id in your dashboard gallery (only when store is true)
costWhat this request cost, in USD (also sent as the X-Cost header)
blurredPresent and true when part of the image was blurred by the content filter

Your gallery

By default the API only returns the image and keeps no copy. Send "store": true to also save it to your dashboard gallery in Studio. Images made in Studio are always saved, since the gallery is Studio's history.

  • Images are encrypted at rest with AES-256 and open only to your account.
  • We never use your images to train models.
  • Saved images are deleted automatically after 30 days. You can delete any image, or all of them, at any time.

Save the b64_json you receive if you need an image for longer than 30 days.

Errors

Image requests use the standard error format. Specific to images:

StatusTypeMeaning
400content_policy_violationThe prompt or image was rejected by the content policy. Nothing is charged
400invalid_request_errorA parameter is out of range or not supported by the endpoint (for example seed on an edit), or an input image is too small, too large or not PNG, JPEG or WebP
403invalid_request_errorThe key may not use this model, or it is an Unlimited Pass key (passes cover chat models only)
404invalid_request_errorUnknown or temporarily unavailable model
429rate_limit_errorImage generation is busy, retry in a moment

Image requests count toward the same per-key and account rate limits as chat requests.