Most AI tasks no longer need a frontier model Read launch post

Gemma 4 31B

An open vision model that reads documents and app screens into the JSON your schema asks for. google/gemma-4-31B-it

  • Accuracy

    MMLU-Pro, answers right · not measured

  • Time per request

    Not timed one request at a time

  • Serverless price

    $0.45 in · $1.50 out

    per 1M tokens

Call it

from pathlib import Path
import base64
import json
from sie_sdk import SIEClient
​
client = SIEClient(api_key="API keysk-sie-…")
​
schema = json.loads("""
schema{
"type": "object",
"properties": {
"items": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {···"brand": ···, "quantity": ···, "reference": ···, "productSpecsJson": {···"watts": ···, "efficiency": ···}, {"type": "null"}]},
"header": {"type": "object", "properties": {···"date": ···}
},
"required": ["items", "header"],
"additionalProperties": false
}
""")
instruction = "instruction···Copy values as they appear on the document.···"
prompt = instruction
image = base64.b64encode(Path(fileJPGdelivery-note.jpgbrowse).read_bytes()).decode("ascii")
# Messages: the prompt as the system message, the image as the user message. Copy includes them.
result = client.chat_completions(
"modelgoogle/gemma-4-31B-it:h100-96k-hires-out8k-no-spec",
messages,
max_completion_tokens=8192,
extra_body={"temperature":0,"presence_penalty":0},
# Strict JSON-schema response_format. Copy includes it.
)
# Copy also reads and parses the JSON reply.
import { readFile } from 'node:fs/promises';
import { SIEClient } from '@superlinked/sie-sdk';

const client = new SIEClient(undefined, { apiKey: 'sk-sie-…' });

const schema = {
  "type": "object",
  "properties": {
    "items": {"anyOf": [{"type": "array", "items": {"type": "object", "properties": {···"brand": ···, "quantity": ···, "reference": ···, "productSpecsJson": {···"watts": ···, "efficiency": ···}, {"type": "null"}]},
    "header": {"type": "object", "properties": {···"date": ···}
  },
  "required": ["items", "header"],
  "additionalProperties": false
};
const instruction = "···Copy values as they appear on the document.···";
const prompt = instruction;
const image = await readFile("delivery-note.jpg");
const result = await client.chatCompletions({
  model: 'google/gemma-4-31B-it:h100-96k-hires-out8k-no-spec',
  // Messages: the prompt as the system message, the image as the user message. Copy includes them.
  max_completion_tokens: 8192,
  temperature: 0,
  presence_penalty: 0,
  // Strict JSON-schema response_format. Copy includes it.
});
// Copy also reads and parses the JSON reply.
document_image=$(base64 < 'delivery-note.jpg' | tr -d '\n')
curl https://api.superlinked.com/v1/chat/completions \
  -H "Authorization: Bearer sk-sie-…" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"google/gemma-4-31B-it:h100-96k-hires-out8k-no-spec\",\"messages\":[{\"role\":\"system\",\"content\":\"···Copy values as they appear on the document.···\"},{\"role\":\"user\",\"content\":[{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/jpeg;base64,$document_image\"}}]}],\"max_completion_tokens\":8192,\"temperature\":0,\"presence_penalty\":0,\"response_format\":{\"type\":\"json_schema\",\"json_schema\":{\"name\":\"fields\",\"strict\":true,\"schema\":{\"type\":\"object\",\"properties\":{\"items\":{\"anyOf\":[{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"sn\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"type\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"LED Luminaire\",\"Power Supply\",\"Control System\",\"Mounting Bracket\",\"LED Driver\",\"Cable Assembly\",\"Junction Box\",\"Sensor Module\"]},{\"type\":\"null\"}]},\"unit\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"pcs\",\"set\",\"unit\"]},{\"type\":\"null\"}]},\"brand\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"Philips\",\"Osram\",\"Schneider Electric\",\"Siemens\",\"ABB\",\"Lutron\",\"Legrand\",\"Mean Well\"]},{\"type\":\"null\"}]},\"quantity\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"reference\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"productSpecsJson\":{\"type\":\"object\",\"properties\":{\"power\":{\"type\":\"object\",\"properties\":{\"watts\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"efficiency\":{\"anyOf\":[{\"description\":\"Efficiency in percentage, 0-100\",\"type\":\"number\"},{\"type\":\"null\"}]},\"powerFactor\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"inputVoltage\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"100-240v\",\"100-277v\",\"220-240v\"]},{\"type\":\"null\"}]}},\"required\":[\"watts\",\"efficiency\",\"powerFactor\",\"inputVoltage\"],\"additionalProperties\":false},\"ratings\":{\"type\":\"object\",\"properties\":{\"protection\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"ip65\",\"ip66\",\"ip67\"]},{\"type\":\"null\"}]}},\"required\":[\"protection\"],\"additionalProperties\":false},\"physical\":{\"type\":\"object\",\"properties\":{\"weight\":{\"anyOf\":[{\"type\":\"number\"},{\"type\":\"null\"}]},\"material\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"aluminum\",\"steel\",\"plastic\"]},{\"type\":\"null\"}]},\"mountingType\":{\"anyOf\":[{\"type\":\"string\",\"enum\":[\"surface\",\"recessed\",\"track\"]},{\"type\":\"null\"}]}},\"required\":[\"weight\",\"material\",\"mountingType\"],\"additionalProperties\":false}},\"required\":[\"power\",\"ratings\",\"physical\"],\"additionalProperties\":false}},\"required\":[\"sn\",\"type\",\"unit\",\"brand\",\"quantity\",\"reference\",\"productSpecsJson\"],\"additionalProperties\":false}},{\"type\":\"null\"}]},\"header\":{\"type\":\"object\",\"properties\":{\"to\":{\"type\":\"object\",\"properties\":{\"tel\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"email\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"location\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"attention\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"reference\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"vatNumber\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"companyName\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]}},\"required\":[\"tel\",\"email\",\"location\",\"attention\",\"reference\",\"vatNumber\",\"companyName\"],\"additionalProperties\":false},\"date\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"from\":{\"type\":\"object\",\"properties\":{\"tel\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"email\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"location\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"reference\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"vatNumber\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]},\"companyName\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]}},\"required\":[\"tel\",\"email\",\"location\",\"reference\",\"vatNumber\",\"companyName\"],\"additionalProperties\":false},\"projectName\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"null\"}]}},\"required\":[\"to\",\"date\",\"from\",\"projectName\"],\"additionalProperties\":false}},\"required\":[\"items\",\"header\"],\"additionalProperties\":false}}}}"
Build the "Doc field extraction" capability into my app using the Superlinked Inference Engine (SIE).

Context
- SIE is an OpenAI-style inference API. Python SDK: `from sie_sdk import SIEClient`; TypeScript: `@superlinked/sie-sdk`.
- Base URL: https://api.superlinked.com (or my regional endpoint). Auth: Bearer key from env `SIE_API_KEY` (never hard-code it).
- Model: google/gemma-4-31B-it:h100-96k-hires-out8k-no-spec (OpenAI-compatible endpoint: /v1/chat/completions). Keep the model id configurable.

Task
- Input: an uploaded document plus the JSON schema for its fields.
- Behaviour: parse the document, then return fields matching the JSON schema
- Send one POST /v1/chat/completions request (SDK: chat_completions / chatCompletions) with a system message and a user message. The system message is "Extract data from the document image into the JSON schema. Copy values as they appear on the document. Use null for a field the document does not contain. Return only the JSON.\n\nJSON schema:\n{\n  \"type\": \"object\",\n  \"required\": [\n    \"header\",\n    \"items\"\n  ],\n  \"properties\": {\n    \"items\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"sn\",\n          \"type\",\n          \"brand\",\n          \"reference\",\n          \"productSpecsJson\",\n          \"unit\",\n          \"quantity\"\n        ],\n        \"properties\": {\n          \"sn\": {\n            \"type\": \"number\"\n          },\n          \"type\": {\n            \"enum\": [\n              \"LED Luminaire\",\n              \"Power Supply\",\n              \"Control System\",\n              \"Mounting Bracket\",\n              \"LED Driver\",\n              \"Cable Assembly\",\n              \"Junction Box\",\n              \"Sensor Module\"\n            ],\n            \"type\": \"string\"\n          },\n          \"unit\": {\n            \"enum\": [\n              \"pcs\",\n              \"set\",\n              \"unit\"\n            ],\n            \"type\": \"string\"\n          },\n          \"brand\": {\n            \"enum\": [\n              \"Philips\",\n              \"Osram\",\n              \"Schneider Electric\",\n              \"Siemens\",\n              \"ABB\",\n              \"Lutron\",\n              \"Legrand\",\n              \"Mean Well\"\n            ],\n            \"type\": \"string\"\n          },\n          \"quantity\": {\n            \"type\": \"number\"\n          },\n          \"reference\": {\n            \"type\": \"string\"\n          },\n          \"productSpecsJson\": {\n            \"type\": \"object\",\n            \"required\": [\n              \"power\",\n              \"physical\",\n              \"ratings\"\n            ],\n            \"properties\": {\n              \"power\": {\n                \"type\": \"object\",\n                \"required\": [\n                  \"watts\",\n                  \"inputVoltage\"\n                ],\n                \"properties\": {\n                  \"watts\": {\n                    \"type\": \"number\"\n                  },\n                  \"efficiency\": {\n                    \"type\": \"number\",\n                    \"description\": \"Efficiency in percentage, 0-100\"\n                  },\n                  \"powerFactor\": {\n                    \"type\": \"number\"\n                  },\n                  \"inputVoltage\": {\n                    \"enum\": [\n                      \"100-240v\",\n                      \"100-277v\",\n                      \"220-240v\"\n                    ],\n                    \"type\": \"string\"\n                  }\n                }\n              },\n              \"ratings\": {\n                \"type\": \"object\",\n                \"required\": [\n                  \"protection\"\n                ],\n                \"properties\": {\n                  \"protection\": {\n                    \"enum\": [\n                      \"ip65\",\n                      \"ip66\",\n                      \"ip67\"\n                    ],\n                    \"type\": \"string\"\n                  }\n                }\n              },\n              \"physical\": {\n                \"type\": \"object\",\n                \"required\": [\n                  \"material\",\n                  \"mountingType\"\n                ],\n                \"properties\": {\n                  \"weight\": {\n                    \"type\": \"number\"\n                  },\n                  \"material\": {\n                    \"enum\": [\n                      \"aluminum\",\n                      \"steel\",\n                      \"plastic\"\n                    ],\n                    \"type\": \"string\"\n                  },\n                  \"mountingType\": {\n                    \"enum\": [\n                      \"surface\",\n                      \"recessed\",\n                      \"track\"\n                    ],\n                    \"type\": \"string\"\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"header\": {\n      \"type\": \"object\",\n      \"required\": [\n        \"from\",\n        \"to\",\n        \"date\",\n        \"projectName\"\n      ],\n      \"properties\": {\n        \"to\": {\n          \"type\": \"object\",\n          \"required\": [\n            \"companyName\",\n            \"reference\",\n            \"location\",\n            \"attention\",\n            \"tel\",\n            \"email\",\n            \"vatNumber\"\n          ],\n          \"properties\": {\n            \"tel\": {\n              \"type\": \"string\"\n            },\n            \"email\": {\n              \"type\": \"string\"\n            },\n            \"location\": {\n              \"type\": \"string\"\n            },\n            \"attention\": {\n              \"type\": \"string\"\n            },\n            \"reference\": {\n              \"type\": \"string\"\n            },\n            \"vatNumber\": {\n              \"type\": \"string\"\n            },\n            \"companyName\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"date\": {\n          \"type\": \"string\"\n        },\n        \"from\": {\n          \"type\": \"object\",\n          \"required\": [\n            \"companyName\",\n            \"reference\",\n            \"location\",\n            \"tel\",\n            \"email\",\n            \"vatNumber\"\n          ],\n          \"properties\": {\n            \"tel\": {\n              \"type\": \"string\"\n            },\n            \"email\": {\n              \"type\": \"string\"\n            },\n            \"location\": {\n              \"type\": \"string\"\n            },\n            \"reference\": {\n              \"type\": \"string\"\n            },\n            \"vatNumber\": {\n              \"type\": \"string\"\n            },\n            \"companyName\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"projectName\": {\n          \"type\": \"string\"\n        }\n      }\n    }\n  }\n}" verbatim, without appending the response schema. The user message holds only an image_url part. Base64-encode the original local image bytes as a canonical data:image/png, data:image/jpeg or data:image/webp URI (normalize jpg to image/jpeg). Use max_completion_tokens 8192, temperature 0 and response_format {type: "json_schema", json_schema: {name: "fields", strict: true, schema}} with the submitted schema unchanged. Parse choices[0].message.content as JSON and fail loudly when it is missing or invalid.

Deliverables
- A typed client wrapper, an application-level function for this task, error handling for timeouts/empty input, and unit tests with a stubbed client.
- Wire it into my existing stack (ask me which framework if unclear) and add a short usage example.
Output

header.date 2025-02-12

items
referencebrandquantitywattsefficiency
ASDZPDI5YLLutron5010395
FL5GMWQOUQOsram518893
delivery-note.jpg
The delivery note sent with this request: 2 line items with their reference, brand, quantity and description.

Next to the other language models

Next to the other language models
Model MMLU-Pro, answers right Time per request Serverless price Size
Qwen3.8 27B Qwen Not measured 0.74 s per complete reply $0.25 in · $2.75 out per 1M tokens 27.8B
GLM-5.3-Flash zai-org Not measured Not timed $0.15 in · $0.50 out per 1M tokens 321.3B
Qwen3.5 4B Qwen 59.3% Not timed $0.305 in · $1.53 out per 1M tokens 4.7B
Qwen3 4B Instruct 2507 Qwen 53.3% Not timed Run in your cloud 4.0B
All 10 chat and document models

Facts

Size
31.3B parameters
License
Apache-2.0
Reads
Text (up to 8,192 tokens), image
Endpoint
generate
Evaluation
Accuracy
Run on SIE against the public dataset named in each figure
Time
SIE timed on a GPU server with the client alongside, one request at a time
Prices
Serverless list prices

Run Gemma 4 31B on Serverless or in your own cloud

SIE Cluster

Kubernetes in your own cloud, backed by our engineers.

  • Terraform modules for your cloud
  • Apache-2.0, same engine as Serverless
  • GPU workers scale to zero between jobs
  • Separate worker pools for each tenant
Agent prompt Deploy SIE to our AWS account with the superlinked/sie/aws Terraform module. Docs: superlinked.com/docs/deployment.Deploy SIE to our Google Cloud project with the superlinked/sie/google Terraform module. Docs: superlinked.com/docs/deployment.Deploy SIE to our Azure subscription with the superlinked/sie/azure Terraform module. Docs: superlinked.com/docs/deployment.Deploy SIE to our Alibaba Cloud account with the superlinked/sie/alicloud Terraform module. Docs: superlinked.com/docs/deployment.

SIE Local

The open-source server on your own machine.

  • NVIDIA GPU, 80 GB
  • One container, no cluster
  • Process your data fully offline
  • Same SDK and model IDs as Serverless
docker run --gpus all -p 8080:8080 ghcr.io/superlinked/sie-server:latest-cuda13-sglang-cu130

Talk to us

Tell us about your use case and we'll get back to you shortly.

Apply for an inference grant

Free capacity on our hosted cluster for selected projects. Tell us what you run and we reply by email.