QR Code

QR_CODE

Turns a text or URL into a QR code image, with a choice of size and error correction.

Utilities

About QR Code

Turns a short piece of text or a URL into a square QR code image.

Library

There are no model weights. Encoding is done by python-qrcode 8.2 from Lincoln Loop. The licence on that project is BSD-3-Clause:

https://github.com/lincolnloop/python-qrcode/blob/main/LICENSE

The original encoder port inside that repository is MIT, copyright Kazuhiko Arase. Images are drawn with Pillow (MIT-CMU), copyright Jeffrey A. Clark and contributors.

The wheel published for qrcode 8.2 is about 45 KB. Nothing is downloaded at runtime.

Limits

The request is rejected when text is empty or longer than 1000 characters, when size is outside 128–2048, or when error_correction is not one of the four letters above. The image is a standard QR symbol, not a styled or logo-bearing code. Very long strings near the 1000-character cap may still fail to fit if error correction is set to H.

QR Code inputs and output

NameTypeRequiredDefaultDetails
texttextYes—Text or URL to encode. At most 1000 characters.
Max 1000 characters
sizeintegerNo512Width and height of the PNG in pixels.
128–2048
error_correctiontextNoMQR error correction: L (7%), M (15%), Q (25%) or H (30%).
Allowed: L, M, Q, H

Output. Returns binary file.

Run QR Code with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=QR_CODE" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "text": "example",
    "error_correction": "M",
    "size": 512
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "QR_CODE",
        {
          "text": "example",
          "error_correction": "M",
          "size": 512
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

QR Code pricing

Price per request: 0.01 credits ($0.0001). The price is shown again before every run; all prices are on the pricing page.

SAM 2.1 Hiera Large: Utilities model on Kainguru
Utilities

SAM 2.1 Hiera Large

Click or draw a box on an object and get back a mask outlining it.

Fine-tunable
Grounded SAM 2: Utilities model on Kainguru
Utilities

Grounded SAM 2

Outlines the things you name in a picture, such as "red car, person with a helmet", with a mask and a box for each one.

Fine-tunable
BiRefNet General: Utilities model on Kainguru
Utilities

BiRefNet General

Removes the background from a photo and returns the subject on a transparent background, or as a black-and-white mask.

Fine-tunable
Cloth Segmentation U2-Net: Utilities model on Kainguru
Utilities

Cloth Segmentation U2-Net

Finds the clothes a person wears in a photo and returns a mask for the upper body, the lower body and full-body…

Fine-tunable
Depth Anything v2 Small: Utilities model on Kainguru
Utilities

Depth Anything v2 Small

Turns any photo into a depth map that shows which parts are near and which are far.

Fine-tunable
DWPose Wholebody: Utilities model on Kainguru
Utilities

DWPose Wholebody

Finds every person in a photo and returns 133 keypoints for each: body, feet, face and both hands, as JSON in the…

Fine-tunable