Skip to main content
POST
Generates one standard image as base64.
Generate one standard image with POST /openai/{region}/v1/images/generations. Send a prompt and an image model from your workspace. The response returns the image as b64_json. The request uses the same Completion API scope as OpenAI Chat Completions and OpenAI Responses. Chat tools, workflow nodes, and Agent API imageGeneration are separate surfaces.

Before You Start

  • API key: Create a personal API key or ask your workspace admin for a workspace API key with the Completion API scope.

Base URL

Dedicated deploymentsReplace api.langdock.com with <your-deployment-url>/api/public in all requests.
The {region} path value must be eu or us. This route does not accept global.

Parameters

The request body is a strict object. Extra fields return 400.

Response

A successful response is JSON with created and data. data contains one object with b64_json and, when the model returns one, revised_prompt. The HTTP body has no usage object. The ld-model-id response header repeats the model ID. Generation times out after 60 seconds. A timeout returns 504 with The model did not respond in time. Please retry.

Differences from the OpenAI API

  • One image per request. n other than 1 is rejected.
  • response_format is b64_json only. URL output is not supported.
  • HD / high-resolution generation is not supported.
  • There is no public /v1/images/edits route.

Using the OpenAI Python library

Set Langdock as the base URL and call images.generate:

Rate limits

The default limits are 500 RPM (requests per minute) and 150,000 TPM (tokens per minute).
  • RPM is enforced per workspace, model, and API key.
  • TPM is shared by all API keys using the same model in a workspace.
  • On dedicated deployments, admins can configure custom limits per model in Settings > Workspace > Products > API.
A rate-limited request returns 429 Too Many Requests. Successful and rate-limited responses include x-ratelimit-limit-requests, x-ratelimit-limit-tokens, x-ratelimit-remaining-requests, and x-ratelimit-remaining-tokens. Personal API key usage counts toward the member’s effective personal budget and the workspace spend limit together with chat and agent usage. Workspace API key usage counts toward the workspace API spend limit. Image generation calls are billed as image generation usage. See Personal API keys and Pricing.
Browser and CORS integrations are not supported. Keep API keys server-side and call the endpoint from a server, CLI, or local development tool. See API Key Best Practices.

Authorizations

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Path Parameters

region
enum<string>
default:eu
required

The region of the API to use. Must be eu or us.

Available options:
eu,
us

Body

application/json
model
string
required

Image generation model ID from your workspace. GET /openai/{region}/v1/models lists chat models, not image models.

Minimum string length: 1
prompt
string
required

The image description.

Minimum string length: 1
n
enum<integer>

Number of images. Only 1 is supported.

Available options:
1
size
enum<string>
default:auto

Output size. auto and 1024x1024 map to square, 1536x1024 to landscape, and 1024x1536 to portrait.

Available options:
auto,
1024x1024,
1536x1024,
1024x1536
quality
enum<string>

Quality hint forwarded to the image model. Not every image model uses it.

Available options:
auto,
low,
medium,
high
response_format
enum<string>

Response format. Only b64_json is supported.

Available options:
b64_json
user
string

Optional end-user identifier. Accepted for OpenAI compatibility.

Response

OK

created
integer
required

Unix timestamp in seconds.

data
object[]
required
Required array length: 1 element