scriptRun Beta

LLM Vision API: Processing Images and PDFs Across OpenAI, Claude, and Gemini

James
December 4, 2026
Business
AI WorkflowsAutomation
LLM Vision API: Images & PDFs in OpenAI, Claude, Gemini

Calling one vision model takes about twenty lines of code. Things get complicated once the same service needs to run across OpenAI, Claude, and Gemini: each provider wraps image bytes in a different JSON schema, counts visual tokens with its own formula, and enforces different frame limits.

Routing requests through ScriptRun's unified API gateway gives you one OpenAI-compatible LLM vision API, so switching models takes a single string edit. The proxy does not override upstream model rules, though. MIME validation, pixel dimensions, and server timeouts stay on your side, and they decide whether a document service holds up under live traffic.

How OpenAI, Claude, and Gemini vision APIs differ

Integrating native SDKs directly means maintaining three separate request builders for the same file. OpenAI's Chat Completions API expects an image_url block with an HTTPS link or a base64 data URI, while OpenAI's Responses API renames that block to input_image. Anthropic's Messages API does not accept data URIs natively - it expects a source object with type: "base64", raw base64 characters with no prefix, and a separate media_type field. Google Gemini splits uploads into inline_data for base64 bytes and file_data for pre-uploaded files.

File restrictions differ across providers as well. An iPhone photo in HEIC format passes into Gemini with no trouble, whereas OpenAI and Claude return HTTP 400 right away. Current limits across all three platforms compare as follows:

Parameter

OpenAI API

Anthropic Claude API

Google Gemini API

Native image block

image_url (Chat Completions), input_image (Responses)

source (type: "base64" + media_type) or URL / file_id

inline_data or file_data / URL

Max file / inline size

20 MB per file (up to 512 MB per request)

10 MB per base64 file (5 MB on Bedrock)

Up to 100 MB inline (larger via Files API)

Resolution / patch limit

Up to 30,000 patches on patch models (8K fails)

8,000×8,000 px (lower cap above 20 images)

Split into 768×768 tiles or preset tiers

Supported formats

PNG, JPEG, WebP, non-animated GIF

JPEG, PNG, GIF (first frame), WebP

PNG, JPEG, WebP, HEIC, HEIF

Max images per request

Up to 1,500

100 (200k context) or 600 (extended context)

Up to 3,600

Calling OpenAI, Claude, and Gemini through one OpenAI SDK on ScriptRun

Rather than maintaining three client wrappers, point the standard OpenAI SDK at ScriptRun's OpenAI-compatible endpoint POST https://scriptrun.ai/v1/chat/completions. Set base_url="https://scriptrun.ai/v1" and pass Authorization: Bearer <API_KEY>. Full proxy behavior and streaming options are covered in our OpenAI-compatible Chat Completions API guide.

The gateway accepts standard image_url blocks inside messages, whether you pass a base64 data URI or a public HTTPS link. Adding several image_url objects inside one content array lets a single request compare two UI screenshots or read multiple invoice pages at once. To switch the LLM vision API between OpenAI, Claude, and Gemini, replace the model string with the target ID from the ScriptRun model catalog.

Python example: sending base64 with magic-byte MIME detection

Detecting MIME types from leading file bytes instead of filename extensions stops HTTP 400 failures when a user renames a PNG file to .jpg. That keeps base64 uploads predictable even on messy user inputs:

import base64
import os
from pathlib import Path
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["SCRIPTRUN_API_KEY"],
    base_url="https://scriptrun.ai/v1",
)


def detect_mime(raw: bytes) -> str:
    if raw.startswith(b"\x89PNG\r\n\x1a\n"):
        return "image/png"
    if raw.startswith(b"\xff\xd8\xff"):
        return "image/jpeg"
    if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP":
        return "image/webp"
    raise ValueError("Unsupported file bytes; convert to JPEG or PNG first.")


def to_data_uri(path: str) -> str:
    raw = Path(path).read_bytes()
    mime = detect_mime(raw)
    encoded = base64.b64encode(raw).decode("ascii")
    return f"data:{mime};base64,{encoded}"


response = client.chat.completions.create(
    # Swap to any active OpenAI, Claude, or Gemini vision model ID in ScriptRun
    model="gpt-4o",
    temperature=0,
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Compare these two UI states and list visual regressions."},
                {"type": "image_url", "image_url": {"url": to_data_uri("before.png")}},
                {"type": "image_url", "image_url": {"url": to_data_uri("after.png")}},
            ],
        }
    ],
)

print(response.choices[0].message.content)

TypeScript example: inspecting images via HTTPS URLs

In the official Node and TypeScript OpenAI SDK, the gateway address uses camelCase baseURL:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.SCRIPTRUN_API_KEY,
  baseURL: "https://scriptrun.ai/v1",
});

async function inspectReceipt(imageUrl: string, modelId = "gpt-4o") {
  const completion = await client.chat.completions.create({
    model: modelId,
    temperature: 0,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "text",
            text: "Extract vendor name, invoice date, currency, and grand total as JSON.",
          },
          {
            type: "image_url",
            image_url: { url: imageUrl },
          },
        ],
      },
    ],
  });

  return completion.choices[0]?.message?.content ?? "";
}

Why multimodal requests return HTTP 400 or 401

When an image request gets rejected before the model even runs, the issue usually falls into one of four buckets:

  • wrong MIME type in the base64 header: labeling PNG bytes as data:image/jpeg;base64,... triggers an upstream validation rejection. Check magic bytes before encoding;

  • external URL download timeout: slow CDNs, expired pre-signed S3 URLs, or private buckets fail when the provider tries to fetch the file. For backend jobs, resize locally and send a base64 data URI instead;

  • Responses API syntax on Chat Completions: sending input_image blocks to /v1/chat/completions breaks compatibility with Claude and Gemini. Stick to type: "image_url";

  • wrong auth header for the route: the chat gateway expects Authorization: Bearer <API_KEY>, while Projects and Workflow routes under /api/v1/ expect X-Api-Key. Swapping them returns HTTP 401 immediately.

How many tokens images consume and how to cut spend

A compressed 4K screenshot takes a few hundred kilobytes on disk, yet inside a vision encoder the same frame can consume nearly 5,000 input tokens. Across 2026 releases, OpenAI, Anthropic, and Google updated their pixel-to-token formulas - changing a model name without controlling frame size can multiply LLM vision API spend overnight.

How OpenAI, Claude, and Gemini convert pixels into tokens

Provider and models

Tiling / patch grid

Scaling and caps

1024×1024 px

1920×1080 px (Full HD)

3840×2160 px (4K)

OpenAI (legacy: GPT-4o, GPT-4.1)

512×512 tiles (170 tok/tile + 85 base)

Fits 2048×2048, short side to 768 px; detail: "low" = 85 tok

765

1,105

1,105

OpenAI patch models (GPT-5.2+, GPT-6 Astra)

32×32 patches × 1.2 multiplier

high caps at 2,500 patches (~3,000 tok); auto on GPT-6 keeps native size up to 30,000 patches

1,229

2,448 (auto)

9,792 (auto) / ~2,931 (high)

Anthropic standard (up to Claude 4.6)

28×28 patches: ⌈w/28⌉ × ⌈h/28⌉

Long edge up to 1,568 px, cap at 1,568 tokens

1,369

1,560

1,560

Anthropic high-res (Claude 4.7+)

28×28 patches: ⌈w/28⌉ × ⌈h/28⌉

Long edge up to 2,576 px, cap at 4,784 tokens

1,369

2,691

4,784

Google Gemini (default tiles)

768×768 tiles (258 tok/tile)

≤384×384 = 258 tok; larger frames split into 768×768 tiles

1,032

1,548

3,870

Google Gemini (media_resolution)

Preset budget per frame

280 (low), 560 (medium), 1,120 (high), 2,240 (ultra_high)

280 to 2,240

280 to 2,240

280 to 2,240

Two details catch developers off guard most often. First, starting with Claude 4.7, high-resolution mode up to 2,576 px is enabled by default, pushing one 4K screenshot from 1,560 to 4,784 tokens (a 3.07× jump). Second, OpenAI's patch models in auto mode do not downscale the source and reject files above 30,000 patches, so an unresized 8K capture (7680×4320, or 32,400 patches) fails immediately.

Why detail: "low" no longer caps your budget

On older OpenAI models like GPT-4o, passing detail: "low" inside image_url capped image usage at 85 tokens. Once you switch models, that flag stops being portable: Claude and Gemini ignore it inside OpenAI blocks, and newer OpenAI generations moved to patch sizing where detail: "low" is either ignored or inconsistent across variants.

The only control that manages LLM vision API image token cost identically across every vendor is resizing images on your server before base64 encoding. Take a batch of 10,000 4K UI screenshots sent to a Claude 4.7+ High-Res model:

  • unresized 4K frames: 4,784 tokens per image, totaling 47,840,000 input tokens;

  • resized to 1280×720 before sending: ⌈1280/28⌉ × ⌈720/28⌉ = 46 × 26 = 1,196 tokens per frame, cutting visual token volume by exactly 75.0%;

  • impact on ScriptRun billing: at the Claude Sonnet 5 catalog rate (3 SR per 1,000 tokens), batch cost drops from 143,520 SR ($1,435.20) to 35,880 SR ($358.80). On Claude Opus 4.8 (5 SR per 1,000 tokens), the same downscale saves 179,400 SR ($1,794.00).

Check current rates on the OpenAI pricing, Claude pricing, and Gemini pricing pages before running a large backfill. If every request shares a long system prompt or JSON schema, pairing pre-resizing with prompt caching reduces repeated text token charges too.

Ready-to-use Python script for preparing images before upload

Before sending a file to any LLM vision API, run it through a lightweight preprocessing helper on your backend. It covers six practical checks in one pass:

  • rejects broken files and thumbnails smaller than 200 px;

  • bakes EXIF orientation into the pixel grid so phone photos do not arrive sideways;

  • places transparent PNGs onto a white background (otherwise dark text on transparency turns into a solid black box);

  • scales the long edge down to 1280-1568 px;

  • re-encodes the frame as RGB JPEG at quality 85;

  • computes a SHA-256 hash for deduplication - caching by hash typically removes 10% to 25% of duplicate API calls on repeated user uploads.

import base64
import hashlib
from io import BytesIO
from PIL import Image, ImageOps

# Optional: uncomment to decode iPhone HEIC/HEIF files with pillow-heif
# import pillow_heif; pillow_heif.register_heif_opener()


def preprocess_image(raw_bytes: bytes, max_edge: int = 1568, quality: int = 85) -> tuple[str, str]:
    """Normalize orientation, format, and size. Returns (data_uri, sha256_hex)."""
    with Image.open(BytesIO(raw_bytes)) as img:
        img = ImageOps.exif_transpose(img)
        if min(img.size) < 200:
            raise ValueError(f"Image too small for reliable reading: {img.size}")

        # Composite alpha channels onto white before converting to RGB
        if img.mode in ("RGBA", "LA") or (img.mode == "P" and "transparency" in img.info):
            rgba = img.convert("RGBA")
            canvas = Image.new("RGB", rgba.size, (255, 255, 255))
            canvas.paste(rgba, mask=rgba.split()[-1])
            rgb = canvas
        else:
            rgb = img.convert("RGB")

        if max(rgb.size) > max_edge:
            rgb.thumbnail((max_edge, max_edge), Image.Resampling.LANCZOS)

        buf = BytesIO()
        rgb.save(buf, format="JPEG", quality=quality, optimize=True)
        normalized = buf.getvalue()

    digest = hashlib.sha256(normalized).hexdigest()
    data_uri = "data:image/jpeg;base64," + base64.b64encode(normalized).decode("ascii")
    return data_uri, digest

Getting clean JSON from scans, tables, and PDFs

Providers handle native PDF files differently: some accept raw application/pdf payloads directly, while others require separate Files API uploads. Rendering PDF pages to standard JPEG images on your server removes that difference so the exact same request works across OpenAI, Claude, and Gemini.

Using pypdfium2 avoids installing Poppler system packages inside containers (unlike pdf2image). Render clean digital PDFs at 150 DPI first, stepping up to 200 DPI only on dense accounting tables or small-print legal schedules. Higher DPI inflates token usage quickly without improving accuracy on ordinary layouts.

Stripping Markdown fences, checking schemas, and routing ambiguous pages

Even when your prompt asks for raw JSON only, models often wrap output in Markdown code fences (```json ... ```). ScriptRun returns completion text and result.content as-is without stripping formatting, so calling json.loads() directly will fail intermittently in production.

To keep PDF-to-JSON extraction reliable across an LLM vision API, add four checks:

  1. strip Markdown fences before parsing: run a regex over the raw response so fenced blocks and plain JSON follow the same code path;

  2. validate field types against a schema: pass the parsed dictionary through Pydantic (Python) or Zod (TypeScript); if a type fails, retry once with the validator error attached;

  3. request an explicit confidence score: have the model return a float from 0.0 to 1.0 plus a warnings list for blurred stamps, clipped totals, or handwritten edits;

  4. send low-confidence pages to human review: route any page below your cutoff (such as confidence < 0.85) to an operator rather than writing questionable numbers into accounting software.

import json
import re
from io import BytesIO
import pypdfium2 as pdfium
from pydantic import BaseModel, Field


class InvoiceExtraction(BaseModel):
    invoice_number: str
    issue_date: str
    currency: str
    total_amount: float
    confidence: float = Field(ge=0.0, le=1.0)
    warnings: list[str] = Field(default_factory=list)


def rasterize_pdf(pdf_path: str, dpi: int = 150) -> list[bytes]:
    """Render each PDF page to PNG bytes for preprocess_image()."""
    pdf = pdfium.PdfDocument(pdf_path)
    scale = dpi / 72.0
    pages: list[bytes] = []
    try:
        for idx in range(len(pdf)):
            bitmap = pdf[idx].render(scale=scale)
            pil_img = bitmap.to_pil()
            buf = BytesIO()
            pil_img.save(buf, format="PNG")
            pages.append(buf.getvalue())
    finally:
        pdf.close()
    return pages


def parse_model_json(raw_text: str) -> InvoiceExtraction:
    cleaned = raw_text.strip()
    match = re.search(r"```(?:json)?\s*([\s\S]*?)\s*```", cleaned)
    if match:
        cleaned = match.group(1)
    payload = json.loads(cleaned)
    return InvoiceExtraction.model_validate(payload)

Processing long PDFs past the 60-second timeout via Workflow API

The synchronous chat endpoint handles single screenshots and short receipts cleanly, but multi-page PDFs quickly hit time limits. ScriptRun's /v1/chat/completions route enforces a 60-second server timeout - sending a 20-page contract in one synchronous HTTP request risks a dropped connection and partial billing.

Batch OCR, multi-step verification, and long PDF runs belong in ScriptRun Workflows triggered through the asynchronous Workflow API. If you want to design the business stages first, see our document process automation guide.

Synchronous chat endpoint vs. asynchronous Workflow API

Parameter

Chat Completions (/v1/chat/completions)

Workflow API (/api/v1/workflows/{id}/run/)

Auth header

Authorization: Bearer <API_KEY>

X-Api-Key: <API_KEY>

Execution model

Synchronous, 60-second timeout

Asynchronous queue (WorkflowRun UUID)

Request body format

OpenAI JSON (model and messages)

Top-level JSON fields (e.g., {"document_url": "..."})

Result delivery

Immediate HTTP 200 response

Polling workflow_result or project webhooks

Retries and approvals

Handled in your code

Built-in re-run and agent-approval routes

Six Workflow API details worth knowing upfront

ScriptRun's asynchronous Workflow API has six specific behaviors - handle them from the start to avoid silent integration failures:

  1. pass input fields directly at the JSON root: under X-Api-Key auth, do not wrap the body in {"input_data": {...}} - that wrapper applies only to browser JWT sessions. Root fields such as {"document_url": "..."} are referenced in workflow steps as {{ input.document_url }}, while plain text with Content-Type: text/plain maps automatically to {{ input.__raw_input__ }};

  2. check the inner status field inside HTTP 200: POST /api/v1/workflows/{id}/run/ returns transport HTTP 200 even when node validation fails. Inspect response["status"]: 201 confirms the run is queued (with its UUID in response["data"]["id"]), whereas 422 returns node validation errors inside data.data;

  3. allow a 1-2 second write delay when polling: poll GET /api/v1/workflows/workflow_result/?id=<run_uuid> every 3 to 5 seconds until data.status reaches "succeed" or "failed" (treat "not found" as transient and retry briefly). Because data.status can switch to "succeed" 1-2 seconds before all node results finish writing, verify that data.data is populated and retry up to three times after a 2-second pause;

  4. read node outputs by UUID rather than key order: data.data is a dictionary keyed by node UUID with no fixed key order. Fetch the target output node UUID from GET /api/v1/workflows/{id}/ (data.nodes[].id), read data.data[node_uuid]["result"]["content"], and strip Markdown fences before parsing JSON;

  5. switch to project webhooks instead of polling loops: enable push callbacks for a workspace via PATCH /api/v1/projects/{id}/ with webhook_url and is_webhook_enabled: true. See our breakdown of webhook vs. API key differences for delivery and auth trade-offs;

  6. use built-in approvals and re-runs for exceptions: an Agent step can pause a borderline document until an operator calls POST /api/v1/workflows/workflow_run/{workflow_run_id}/agent-approval/{request_id}/approve/ or .../reject/. If an upstream provider blip sends a job to the failed queue (DLQ), replay it with its saved inputs via an empty POST /api/v1/workflows/{id}/history/{run_id}/re-run/.

import time
import requests

API_KEY = "<Your API Key>"
BASE = "https://scriptrun.ai/api/v1"


def run_vision_workflow(workflow_id: int, target_node_uuid: str, doc_url: str, timeout_s: int = 180):
    headers = {"X-Api-Key": API_KEY, "Content-Type": "application/json"}

    # 1. Start the workflow with top-level JSON fields
    start_resp = requests.post(
        f"{BASE}/workflows/{workflow_id}/run/",
        headers=headers,
        json={"document_url": doc_url},
        timeout=30,
    )
    start_resp.raise_for_status()
    start_body = start_resp.json()
    if start_body.get("status") != 201:
        raise RuntimeError(f"Workflow validation failed: {start_body}")

    run_id = start_body["data"]["id"]
    deadline = time.time() + timeout_s
    consistency_retries = 0

    # 2. Poll until terminal status AND target node payload is available
    while time.time() < deadline:
        poll_resp = requests.get(
            f"{BASE}/workflows/workflow_result/",
            headers={"X-Api-Key": API_KEY},
            params={"id": run_id},
            timeout=30,
        )
        poll_resp.raise_for_status()
        executor_data = poll_resp.json().get("data", {})
        status = executor_data.get("status")

        if status in {"succeed", "failed"}:
            node_map = executor_data.get("data") or {}
            if status == "failed":
                raise RuntimeError(f"Workflow run {run_id} failed: {node_map}")
            if target_node_uuid in node_map:
                raw_content = node_map[target_node_uuid]["result"]["content"]
                return parse_model_json(raw_content)  # helper defined above
            if consistency_retries < 3:
                consistency_retries += 1
                time.sleep(2)
                continue
            raise KeyError(f"Target node {target_node_uuid} missing in run {run_id}")

        time.sleep(3)

    raise TimeoutError(f"Workflow run {run_id} exceeded {timeout_s}s")

Model cascading, 60 RPM quotas, and per-project spend tracking

Sending every uploaded file straight to a flagship model burns budget on blank separator sheets, blurry phone photos, and simple receipts. Cascading stages keep costs low on routine pages while reserving heavier models for dense tables and ambiguous scans.

Filtering simple and unreadable pages with a low-cost model

Run every incoming page through an inexpensive LLM vision API model first to classify the document and reject unreadable scans. Because the price spread between lightweight models and flagships in the ScriptRun catalog reaches 187.5×, filtering early pays off immediately:

Processing stage

Example ScriptRun models

Cost per 1,000 tokens

What it handles

Stage 1: sorting and quality gate

GPT-5 nano, Gemini 2.5 Flash-Lite

0.08 SR ($0.0008)

Page classification, blank/blur rejection, routing branch

Stage 2: standard extraction

GPT-5.4 mini, Claude Haiku 4.5

0.9 SR ($0.009) / 1 SR ($0.01)

Receipts, simple single-column forms, basic screenshots

Stage 3: dense documents and tables

Claude Sonnet 4.6 / 5, Gemini 2.5 Pro

3 SR ($0.03)

Multi-column invoices, contracts, financial charts

Stage 4: complex edge cases

Claude Opus 4.8 / 5, GPT-6 Astra

5 SR ($0.05) / 15 SR ($0.15)

Low-confidence re-checks and intricate visual analysis

Inside ScriptRun Workflows, an IF branching node costs 0 SR per call, while HTTP and Webhook steps cost 0.01 SR each. Routing blank and routine scans off at Stage 1 cuts monthly token volume without lowering extraction accuracy on complex PDFs.

Staying within the default 60 RPM quota

Every ScriptRun API key starts with a default quota of 60 requests per minute (60 RPM). When processing a large queue, pace backend workers with a token bucket just below that cap so parallel bursts do not hit HTTP 429. Add exponential backoff with jitter on 429 responses - working retry templates are detailed in our guide on fixing OpenAI API 429 rate limits. If production volume requires higher throughput, request custom key limits via support@scriptrun.ai or @scriptrunai on Telegram.

Tracking real spend by project and workflow run

Keep separate applications, staging environments, and client workloads in distinct workspaces inside ScriptRun Projects so SR token consumption stays transparent. Three API endpoints using the X-Api-Key header expose exact spend in code:

  • project totals: GET /api/v1/projects/{id}/ returns total_spent in both USD and SR as decimal strings;

  • workflow run history: GET /api/v1/workflows/history/?workflow_id={id}&limit=10 (or GET /api/v1/workflows/{id}/history/ sorted by ordering=-created_at or -cost) shows per-run charges; when running marketplace templates, subtract commission from cost inside external_cost_usd to get net AI spend;

  • per-node billing breakdown: GET /api/v1/billing-history/workflowrun/{run_id}/ breaks down spend by executed node so you can spot any single vision step burning unexpected tokens.

To keep an image and document service predictable on both cost and stability, control payloads before bytes leave your server: normalize orientation and resolution locally, clean and validate JSON against a schema, and move long PDF batches off the 60-second synchronous endpoint into asynchronous workflows. With one OpenAI-compatible SDK and per-project SR tracking, testing a new OpenAI, Claude, or Gemini release in your LLM vision API takes a single line change in config.


Helpful?
Share this article!

Build AI workflows in minutes

Create automations, connect APIs, and access 50+ AI models from a single platform.

Visual workflow builder
OpenAI-compatible API
Workflow marketplace & templates
Start free, plans from $5

FAQs about LLM vision API

How can I send base64 images to OpenAI, Claude, and Gemini through one LLM vision API?

Point the standard OpenAI SDK at https://scriptrun.ai/v1 and pass your key in Authorization: Bearer <API_KEY>. Send images as base64 data URIs inside standard image_url blocks, inspecting magic bytes first so the declared MIME type matches the actual file. Switching between OpenAI, Claude, and Gemini then takes changing only the model string.

What image format and resolution work reliably across OpenAI, Claude, and Gemini?

Convert uploads to RGB JPEG at quality 85 with the long edge capped at 1280-1568 px, bake EXIF orientation into the pixel grid, and composite transparent PNGs onto a white background. OpenAI and Claude reject iPhone HEIC files with HTTP 400, while unresized 8K frames exceed the 30,000-patch ceiling on newer OpenAI patch models. Hashing normalized bytes with SHA-256 also removes 10% to 25% of duplicate uploads.

Why does detail: "low" stop saving vision API image token costs across providers?

The detail: "low" flag locks input to 85 tokens on legacy OpenAI models like GPT-4o, yet Claude, Gemini, and newer OpenAI patch generations ignore it or handle it inconsistently. Resizing images on your client before encoding is the only portable way to cap spend. Scaling a 4K screenshot to 1280×720 drops visual input on Claude 4.7+ high-res models from 4,784 tokens to 1,196, cutting token volume by 75.0%.

How do I extract structured JSON from multi-page PDFs with a vision API?

Rasterize each PDF page on your server using pypdfium2 at 150 DPI for clean digital files (or 200 DPI for dense tables), then pass those frames through your image preprocessor. Strip Markdown JSON code fences with a regex before calling json.loads(), validate fields against Pydantic or Zod schemas, and route pages with low confidence scores to manual review.

How do I run batch OCR and multi-page PDF jobs past the 60-second API timeout?

Move multi-page PDFs off the synchronous /v1/chat/completions endpoint into POST /api/v1/workflows/{id}/run/ using X-Api-Key authentication and a flat JSON body. Check the inner response["status"] key inside HTTP 200 (201 confirms queuing, 422 reports node validation errors). Collect outputs through project webhooks or by polling GET /api/v1/workflows/workflow_result/ until data.status is terminal and data.data is populated.

How can I lower vision API costs and audit spend per project on ScriptRun?

Use two-tier routing: triage pages and drop blurry or blank scans on GPT-5 nano or Gemini 2.5 Flash-Lite (0.08 SR per 1,000 tokens), then escalate dense tables to Claude Sonnet 5 (3 SR) or Claude Opus 4.8 (5 SR). Group workloads into separate ScriptRun Projects and pull exact figures from GET /api/v1/projects/{id}/ for project totals and GET /api/v1/billing-history/workflowrun/{run_id}/ for per-node charges.

Read more from our blog

Related posts

AI WorkflowsAutomation
Zapier Alternatives: 8 Tools Compared on Price (2026)
BusinessDecember 4, 2026

Zapier Alternatives: 8 Tools Compared on Price (2026)

Zapier alternatives compared: what each tool costs, how it counts usage, a 10,000-action cost example, and open-source and enterprise picks.

1744
AnnaAnna
AI WorkflowsAutomation
What Is OpenRouter? How It Works, Pricing and Limits (2026)
BusinessDecember 3, 2026

What Is OpenRouter? How It Works, Pricing and Limits (2026)

What is OpenRouter and should you use it? How the gateway works, what it costs, free limits, Auto Router and Fusion, privacy and who owns it.

1558
AnnaAnna
AI WorkflowsAutomation
OpenAI API Alternative: 8 Providers Compared for 2026
BusinessDecember 2, 2026

OpenAI API Alternative: 8 Providers Compared for 2026

Eight OpenAI API alternatives compared on current prices, speed, context and what changes when you switch, with a checklist and a gateway option.

1588
AnnaAnna
AI WorkflowsAutomation
OpenAI API Cost in 2026: Prices per Model and Examples
BusinessDecember 1, 2026

OpenAI API Cost in 2026: Prices per Model and Examples

OpenAI API cost explained: GPT-6.x prices, cached tokens, Batch and Flex discounts, a cost formula with worked examples, and ways to save.

1543
AnnaAnna
© 2024-2026 PIXEL LORIS IT SERVICES L.L.C. All rights reserved.