{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flowchartai-org/json-schema/flowchartai-org-generation-schema.json",
  "title": "Generation",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/flowchartai-org-v1-openapi.json#/components/schemas/Generation",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "prompt",
    "max_credits"
  ],
  "properties": {
    "prompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 12000
    },
    "max_credits": {
      "type": "integer",
      "minimum": 1,
      "maximum": 2000,
      "description": "Upper limit. A cap below the full-context estimate returns 409 max_credits_too_low with required_credits before generation. Never raise it without owner authorization. The accepted reservation may be lower; actual full-task provider usage is capped at that reservation."
    },
    "image": {
      "type": "string",
      "description": "Optional PNG/JPEG/WebP base64 data URI, at most 2 MB decoded. Arbitrary URLs are not fetched."
    },
    "diagram_id": {
      "type": "string",
      "description": "Existing owned native file to edit; omit to create. Edits also require diagrams:read in addition to diagrams:write and diagrams:generate."
    },
    "expected_version": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$",
      "description": "Required when diagram_id is set. Read the latest file first."
    }
  },
  "dependentRequired": {
    "diagram_id": [
      "expected_version"
    ]
  }
}