Foldbun Stack
中Get an API keyComing soon

Foldbun Stack

Pay-per-use vision model API

Segmentation, OCR, document parsing, image embeddings and background removal through one REST API. Each call is billed in credits per image, prompt or page, with no subscription.

Read the docsTry in PlaygroundComing soon
  • Public model pool right after sign-up: ppocr-v6, dinov3 and siglip2, 100 calls per day.
  • Credits do not expire. Failed calls cost nothing.
  • Sign in with Foldbun ID.
sam3Text promptscarpersonSample result
Street scene segmented by SAM 3: 9 cars outlined in blue and 18 people in teal.
27 instances · car 9 · person 18
This call: image encoding 0.5 + 2 text prompts × 0.05 = 0.6 credits (≈ US$0.0006 top-up)

First request in a few minutes

One HTTPS endpoint per task, JSON in and out, authenticated with a Bearer API key.

  1. Create an API key

    Sign in to the console with Foldbun ID and create a key. The public model pool is available at once.

    Open the consoleComing soon
  2. Send an image

    Send the image as base64, or reuse the img_ handle returned by an earlier response instead of uploading it again.

  3. Read the result

    Polygons, boxes, text lines with word boxes, Markdown or vectors. Every response states its cost and the remaining balance.

    Read the documentation
# macOS: replace "base64 -w0 street.webp" with "base64 -i street.webp"
curl https://api.stack.foldbun.com/v1/segment \
  -H "Authorization: Bearer $FOLDBUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EOF
{"model": "sam3", "image": {"base64": "$(base64 -w0 street.webp)"},
 "prompts": [{"text": "car"}, {"text": "person"}]}
EOF
import base64, os, requests

with open("street.webp", "rb") as f:
    image = base64.b64encode(f.read()).decode()

r = requests.post(
    "https://api.stack.foldbun.com/v1/segment",
    headers={"Authorization": f"Bearer {os.environ['FOLDBUN_API_KEY']}"},
    json={"model": "sam3",
          "image": {"base64": image},
          "prompts": [{"text": "car"}, {"text": "person"}]},
    timeout=60,
)
r.raise_for_status()
print(r.json())
{
  "id": "call_01a1913c-25a0-73fd-a074-7a6ac6154590",
  "model": "sam3",
  "image": {"height": 1008, "id": "img_312c4e3a…c6e2", "width": 1343},
  "cache": "miss",
  "imageFee": 0.5,
  "instances": [
    {
      "score": 0.9696,
      "bbox": [0, 716, 207, 889],
      "area": 27120,
      "prompt": 0,
      "label": "car",
      "polygon": [
        {"outer": [47, 718, 100, 728, 132, 743, …]}
      ]
    }
    … 26 more
  ],
  "dropStats": [],
  "cost": 0.6,
  "balance": 1233.96
}

Models

Seven models for segmentation, text, documents, embeddings and background removal. The images below are recorded outputs of the API.

Models and pricing
Segmentation

SAM 3sam3

Segmentation from text, exemplar boxes and points.

0.5 per image encoding + 0.05 per text prompt + 0.02 per point prompt + 0.02 per refinement

Segmentation

SAM 2.1 Hiera-Ssam-lite

Segmentation from points and boxes.

0.2 per image encoding + 0.01 per point or box prompt + 0.01 per refinement

Free
Text and documents

PP-OCRv6ppocr-v6

Text from screenshots and regions, with word boxes.

0.25 per image

Public
Text and documents

PaddleOCR-VLpaddleocr-vl

Document parsing: layout, tables and formulas to Markdown.

2 per page

Background removal

BiRefNetbirefnet

Background removal with hair-level alpha.

1 per image

Models and pricing

Unit prices, model pools, limits and licences for every model.

Pricing

Prices are in credits. Failed calls cost nothing. There is no subscription and no monthly fee, and credits do not expire.

Full price list
ModelUnit prices (credits)Example callCredits per 1,000 calls
sam30.5 per image encoding + 0.05 per text prompt + 0.02 per point prompt + 0.02 per refinement1 image, 1 text prompt550
≈ US$0.55 top-up
sam-lite0.2 per image encoding + 0.01 per point or box prompt + 0.01 per refinement1 image, 1 point210
≈ US$0.21 top-up
ppocr-v60.25 per image1 image250
≈ US$0.25 top-up
paddleocr-vl2 per page1 page2,000
≈ US$2.00 top-up
dinov30.05 per image1 image50
≈ US$0.05 top-up
siglip20.05 per image, 0.01 per text input1 image50
≈ US$0.05 top-up
birefnet1 per image1 image1,000
≈ US$1.00 top-up

SAM image encoding is charged once per call and waived while the same image is still cached for the account. Cached encodings are kept for at most 7 days and may be dropped earlier, so estimates should include the fee.

PublicAfter sign-up

ppocr-v6, dinov3, siglip2

100 calls per day, 10 per minute, at no charge.

FreeAfter the first top-up

+ sam-lite

1,000 calls per day included at no charge, 60 per minute. Further calls are billed from the balance.

With a balance

All models

Billed from the balance at the unit prices.

Top-upsTop-ups are credited at US$1 = 1,000 credits, from a minimum of US$0.99. Online top-up isn't available yet; top-ups are arranged through support.

API details

Documentation

Billed per prompt

SAM 3 bills the image encoding once per call, then each text prompt or exemplar box (segment) and each point (refine), so several prompts on one image cost little more than one.

Image handles

Each response returns an img_ handle for the image. Follow-up calls on the same image send the handle instead of the bytes.

Original-size coordinates

All coordinates are pixels of the original image with EXIF orientation applied, and its size comes with every result. Masks can be smaller and carry their own size.

Safe retries

Calls that spend credits accept an Idempotency-Key header. A repeated call returns the original response and is not charged again.

Frequently asked questions

What is a credit?

Credits are the billing unit of Foldbun Stack. Prices, the balance and the cost of every call are stated in credits. Top-ups are credited at US$1 = 1,000 credits.

Do credits expire?

No. Credits stay on the balance until they are spent.

Is there a free tier?

Accounts can call the public model pool (ppocr-v6, dinov3, siglip2) right after sign-up, 100 calls per day. After the first top-up the free pool adds sam-lite with 1,000 calls per day at no charge. There are no monthly free credits.

How are top-ups made?

Online top-up isn't available yet. Top-ups are arranged through support; the console shows how to contact support and the account ID to quote. The minimum top-up is US$0.99.

Is the SAM encoding fee charged on every call?

The encoding fee is charged once per SAM call. When the encoding of the same image is still cached for the account, the fee is waived and the response says "cache": "hit" with "imageFee": 0. Cached encodings are deleted after at most 7 days, and may be dropped earlier.

Which images are accepted?

JPEG, PNG and static WebP, up to 20 MiB and 40 megapixels, sent as base64 or as an img_ handle from an earlier response.

Foldbun Stack — pay-per-use vision model API

Sign in with Foldbun ID to create an API key. The public model pool is available right away.

Read the docsTry in PlaygroundComing soon