Stateless document conversion API

Genflows API

Convert procedure PDFs and images to V1 - VLM JSON or V2 - CaptureGraph DAG. Provider keys are request-only and are not stored.

Interactive Request

Choose a version and provider. Upload a PDF or image, or use the bundled sample.

Prompt Optional

Request Examples


          

Response

No request sent yet.

Empirical evaluation pricing

Cost Estimator

Estimate model API spend from the observed August 2026 evaluation. One repetition processes every document once with each selected provider.

Rates include the retry and regeneration behavior observed across the 10-document pilot and 79-document full study.

Providers and empirical cost per document-run
Expected API cost $31.26
Planning budget $37.51 Includes a 20% safety margin
Document-runs
79
Selected unit cost
$0.3957

Model API charges only. Hosting, storage, taxes, local evaluation compute, and unrelated account activity are excluded.

API Reference

Shared request fields apply to both conversion versions.

JSON Request Shape

{
  "provider": "openai",
  "api_key": "$OPENAI_API_KEY",
  "filename": "document.pdf",
  "mime_type": "application/pdf",
  "document_base64": "<base64 file bytes>",
  "prompt": "Extract procedural steps."
}

Shared Fields

provideropenai, gemini, anthropic
api_keyrequest-only provider key
filemultipart PDF, PNG, JPG, or JPEG
document_base64JSON request file bytes
promptoptional extraction instructions
modeloptional provider model override

Errors return JSON with error and docs_url. Typical requests take 10 seconds to 4 minutes depending on file size and provider.

Conversion Endpoints

POST /api/convert V1 - VLM JSON

Returns procedures, sections, and steps. Accepts multipart uploads or JSON with base64 file bytes.

curl -X POST https://genflows-api.vercel.app/api/convert \
  -F provider=openai \
  -F api_key="$OPENAI_API_KEY" \
  -F file=@/path/to/document.pdf \
  -o result.json

Version-Agnostic Endpoints

GET /api/health

Dependency health and stateless mode.

GET /api/sample

Bundled V2 CaptureGraph sample for the viewer.

Release history

Changelog

Newest first. Expand an update for changes and JSON DAG migration guidance.

Evaluation cost estimator

What changed

  • The API webpage now estimates evaluation spend from document count, repetitions, selected providers, and a configurable safety margin.
  • Provider unit costs are based on the archived 10-document pilot and 79-document full evaluation, including their observed regeneration overhead.

Compatibility

  • No API request or response formats changed.
  • The estimates cover model API charges only and are planning figures rather than live billing quotes.
Deterministic V2 navigation repair and reduced regeneration

What changed

  • Dangling V2 goto markers are removed deterministically while preserving all surrounding clinical branch content.
  • Every structural repair is disclosed in metadata.deterministic_repairs.
  • Duplicate wording and one-option choices no longer trigger a second full-document model generation.
  • Broken loop targets and other clinically meaningful structural failures still receive the existing focused repair attempt.

Existing JSON DAG compatibility

  • No migration is required; the new metadata field is additive.
  • Regenerated workflows may use fewer provider tokens when the first extraction contains only repairable navigation defects.
Unconditional loop extraction and V2 cycle generation

What changed

  • The V2 extraction format now identifies return targets and represents unlabeled return arrows as explicit unconditional loop connectors.
  • Loop connectors are compiled into real CaptureGraph back-edges, including loops reached from decision branches.
  • V2 metadata now reports expects_cycles and contains_cycles so the viewer can validate the generated graph accurately.

Existing JSON DAG compatibility

  • Existing V2 JSON files remain compatible and continue to load normally.
  • Regenerate files containing unconditional return arrows to receive the new cycle edges and metadata.
Viewer graph integrity and cycle validation

What changed

  • The viewer now detects missing node references, nodes disconnected from the root, and cyclic workflows that contain no cycle edge.
  • Structurally incomplete workflows display Reachable Path Complete instead of incorrectly reporting the entire procedure as complete.

Existing JSON DAG compatibility

  • No migration is required; existing graphs continue to load and now receive additional integrity checks.
Local Python test environment configuration

What changed

  • Added workspace Python settings that select .venv/bin/python and enable pytest discovery for the tests directory.
  • The local virtual environment now installs both production and development requirements so editor analysis can resolve pytest and application imports.

Existing JSON DAG compatibility

  • No JSON DAG changes are required for this development-environment update.
Vercel production routing recovery

What changed

  • Removed the catch-all Vercel rewrite that replaced every incoming path with /api/index.py and caused the homepage, viewer, and API routes to return JSON 404 responses.
  • Vercel now uses its native FastAPI routing so the application receives the original requested path.
  • Added regression tests for the Vercel entrypoint, homepage, viewer, health endpoint, content types, and deployment configuration.

Existing JSON DAG compatibility

  • No JSON DAG changes are required for this deployment-only fix.
  • Existing v2 files, including SwitchString branches and optional button_text settings, remain compatible.
Multiple-choice routing and instruction action labels

What changed

  • Multiple-choice steps now support any number of options, with every option routed to its own next step or nested sequence through SwitchString.
  • Instruction buttons accept optional settings.button_text, such as Start or Continue.
  • The instruction button default changed from Got it to Next.

Existing JSON DAG compatibility

  • No change is required for existing DAGs that use IfThenElse, non-branching UserInputSelectString, or ShowInstructions. Missing button_text automatically displays Next.
  • To retain a different instruction label, add "button_text": "Your label" to that ShowInstructions.settings object.
  • To make an existing select branch, add a SwitchString node whose inputs.selection points to the UserInputSelectString. Copy the ordered choices to SwitchString.settings.options, place the matching branch node IDs in SwitchString.substeps in the same order, and have the parent reference the switch node.
  • The option and branch arrays must remain the same length and order: option at index 0 follows branch at index 0, and so on.