LINKORA
OverviewQuickstart

Image Generation

Generate images from text prompts with any model

Beta

Beta Server tools are currently in beta. The API and behavior may change.

The linkora:image_generation server tool enables any model to generate images from text prompts. When the model determines it needs to create an image, it calls the tool with a description. Linkora executes the image generation and returns the result to the model.

How It Works

  1. You include { "type": "linkora:image_generation" } in your tools array.
  2. Based on the user's request, the model decides whether image generation is needed and crafts a prompt.
  3. Linkora generates the image using the configured model (defaults to openai/gpt-image-2.6-flare).
  4. The generated image URL is returned to the model.
  5. The model incorporates the image into its response. It may generate multiple images in a single request if needed.

Quick Start

const response = await fetch('https://link-ora.net/api/v1/responses', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <LINKORA_API_KEY>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'openai/gpt-5.2',
    input: 'Create an image of a futuristic city at sunset',
    tools: [
      { type: 'linkora:image_generation' }
    ]
  }),
});

const data = await response.json();
const message = [...data.output].reverse().find((item: { type: string }) => item.type === 'message');
console.log(message?.content.find((part: { type: string; text?: string }) => part.type === 'output_text')?.text);

// The generated image is a separate output item, as a data: URL
const images = data.output.filter(
  (item: { type: string; result?: string }) => item.type === 'linkora:image_generation',
);
for (const image of images) {
  if (image.result) console.log(image.result);
}

Configuration

The image generation tool accepts optional parameters to customize the output:

{
  "type": "linkora:image_generation",
  "parameters": {
    "model": "openai/gpt-image-2.6-flare",
    "quality": "high",
    "aspect_ratio": "16:9",
    "size": "1024x1024",
    "background": "opaque",
    "output_format": "png"
  }
}
ParameterTypeDefaultDescription
`model`string`openai/gpt-image-2.6-flare`Which image generation model to use. See [available image models](https://link-ora.net/models?output_modalities=image).
`quality`stringN/AImage quality level (model-dependent, e.g. `"low"`, `"medium"`, `"high"`)
`size`stringN/AImage dimensions (e.g. `"1024x1024"`, `"512x512"`)
`aspect_ratio`stringN/AAspect ratio (e.g. `"16:9"`, `"1:1"`, `"4:3"`)
`background`stringN/ABackground style (e.g. `"transparent"`, `"opaque"`)
`output_format`stringN/AOutput format (e.g. `"png"`, `"jpeg"`, `"webp"`)
`output_compression`numberN/ACompression level (0-100) for lossy formats
`moderation`stringN/AContent moderation level (e.g. `"auto"`, `"low"`)

All parameters except model are passed directly to the underlying image generation API. Available options depend on the specific model being used.

Response

The generated image is returned as its own item in the response output array, before the model's message:

{
  "type": "linkora:image_generation",
  "id": "ig_abc123",
  "status": "completed",
  "result": "data:image/png;base64,...",
  "imageUrl": "data:image/png;base64,...",
  "prompt": "A futuristic city at sunset"
}

When the model calls the image generation tool, it receives a response like:

{
  "status": "ok",
  "imageUrl": "data:image/png;base64,..."
}

If generation fails, the response includes an error:

{
  "status": "error",
  "error": "Generation failed due to content policy"
}

Example with Parameters

Pass parameters on the tool entry to configure it:

const response = await fetch('https://link-ora.net/api/v1/responses', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <LINKORA_API_KEY>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'openai/gpt-5.2',
    input: 'Generate an image of a mountain landscape',
    tools: [
      {
        type: 'linkora:image_generation',
        parameters: { quality: 'high' }
      }
    ]
  }),
});

const data = await response.json();
const message = [...data.output].reverse().find((item: { type: string }) => item.type === 'message');
const text = message?.content.find(
  (part: { type: string; text?: string }) => part.type === 'output_text',
)?.text;
if (text) console.log(text);

const images = data.output.filter(
  (item: { type: string; result?: string }) => item.type === 'linkora:image_generation',
);
for (const image of images) {
  if (image.result) console.log(image.result);
}
if (!text && !images.some((image) => image.result)) {
  throw new Error('Response contained neither text nor a generated image');
}

Pricing

Image generation pricing depends on the underlying model used:

The cost is in addition to standard LLM token costs for processing the request and response.

Next Steps