Skip to content

Generate Image

Generate high-quality images using AI models. Images are automatically stored on Arweave and include In Process moment metadata for provenance and ownership tracking.

Endpoint

GET https://recoup-api.vercel.app/api/image/generate

Parameters

NameTypeRequiredDescription
promptstringYesText description of the image you want to generate
account_idstringYesThe unique identifier of the account generating the image

Request Examples

cURL
curl -X GET "https://recoup-api.vercel.app/api/image/generate?prompt=tuxedo%20cat%20playing%20the%20trumpet%20in%20cali,%20colombia&account_id=YOUR_ACCOUNT_ID" \
  -H "Content-Type: application/json"

Response Format

The API returns JSON responses based on Experimental_GenerateImageResult from the AI SDK, with additional fields for Arweave storage and In Process moment metadata. Here's an example success response:

{
  "images": [
    {
      "base64": "iVBORw0KGgoAAAANSUhEUgAA...",
      "uint8Array": [137, 80, 78, 71, 13, 10, 26, 10, ...],
      "mediaType": "image/png"
    }
  ],
  "warnings": [],
  "responses": [
    {
      "finishReason": "stop"
    }
  ],
  "providerMetadata": {
    "model": "dall-e-3",
    "size": "1024x1024"
  },
  "usage": {
    "promptTokens": 25,
    "completionTokens": 0,
    "totalTokens": 25
  },
  "imageUrl": "https://arweave.net/XhmPPKsPa8DQo7AQoJCkLH2vrkan6ubIbc5yS9Jwt1I",
  "arweaveResult": {
    "id": "XhmPPKsPa8DQo7AQoJCkLH2vrkan6ubIbc5yS9Jwt1I",
    "last_tx": "XhmPPKsPa8DQo7AQoJCkLH2vrkan6ubIbc5yS9Jwt1I",
    "owner": "owner_address",
    "tags": [],
    "target": "",
    "quantity": "0",
    "data": "",
    "reward": "0",
    "signature": "signature_string",
    "format": 2
  },
  "moment": {
    "contractAddress": "0xbEd70CFac86669f4C56E899efC3F50B551037511",
    "tokenId": "1",
    "hash": "0x6c9bee2cf445068af08982fc06c6654ebb755b52370cb9d8a869093a3f3cab5b",
    "chainId": 8453
  }
}

Response Properties

Response Object

The response extends Experimental_GenerateImageResult from the AI SDK and includes the following properties:

PropertyTypeDescription
imagesarrayArray of generated image objects (GeneratedFile from AI SDK)
images[].base64stringFile as a base64 encoded string
images[].uint8ArrayarrayFile as a Uint8Array (represented as array of numbers in JSON)
images[].mediaTypestringThe IANA media type of the file (e.g., "image/png", "image/jpeg")
warningsarrayArray of warning messages, if any
responsesarrayArray of response metadata from the AI provider
providerMetadataobjectMetadata from the AI provider (model, size, etc.)
usageobjectToken usage information
usage.promptTokensnumberNumber of tokens used in the prompt
usage.completionTokensnumberNumber of tokens used in the completion (typically 0 for image generation)
usage.totalTokensnumberTotal tokens used
imageUrlstringPermanent Arweave URL where the image is stored
arweaveResultobjectArweave transaction object (Transaction type from @arweave/web)
momentobjectIn Process moment metadata for provenance and ownership tracking
moment.contractAddressstringSmart contract address for the moment
moment.tokenIdstringToken ID of the minted moment
moment.hashstringTransaction hash of the moment mint
moment.chainIdnumberChain ID (e.g., 8453 for Base)

Notes

  • Images are generated using gpt-image-1
  • All generated images are automatically stored on Arweave for permanent storage
  • Each generation creates an onchain moment with In Process
  • The moment object provides ownership and provenance tracking onchain
  • The arweaveResult contains the full Arweave transaction details
  • The response structure follows the AI SDK's Experimental_GenerateImageResult format
  • Content filtering is applied to all prompts to ensure appropriate content
  • The API has rate limits for image generation (contact support for details)