model and messages envelope with two
GLiNER-specific details:
- Add a top-level
schemadescribing extraction, classification, structured records, or relations. - Parse the JSON string in
choices[0].message.content.
Fastino GLiNER Agent Skill
Install the GLiNER skill in Cursor, Claude Code, or Codex.
View the API contract
Every request and response field.
GLiNER cookbooks
Tested requests for entities, classification, and relations.
Set up your API key
Set your key as an environment variable so the examples below work as-is:Request
string
required
An inference-capable base-model ID or the UUID of a completed, deployable Fastino training
job.
object[]
required
A non-empty list of messages. For GLiNER inference, put the text to analyze in a user
message’s
content.object
Defines custom encoder tasks. For classic extraction and classification, supply a dictionary
containing one or more of
entities, classifications, structures, or relations.
For constrained classification, supply the native version, tasks, and constraints
shape documented below. Omit schema only when the selected model has a configured default
task. Every entry in classic classifications requires at least one label.A flat array of entity labels is deprecated. Always use the dictionary shape.number
default:"0.5"
Confidence threshold from
0 to 1. Lower values favor recall; higher values favor
precision.boolean
default:"true"
Include confidence values in extracted results.
boolean
default:"true"
Include half-open character offsets (
start, end) in entity results.boolean
default:"true"
Persist the inference. Set to
false to opt out.Entity schema
Use descriptive entity definitions when possible:Classification schema
task, labels, multi_label, cls_threshold, and top_k. On GLiNER-2.5-Decide, labels must be a list of strings and top_k currently has no effect; see Decide classification.
Constrained classification schema
GLiNER2.5 Multi can jointly decode related classification tasks under hard constraints. Confirm that the selected model reportsconstrained_classification in encoder_features from GET /v1/base-models before using this schema.
Tasks use cardinality and ordering fields:
- Single answer:
min_labels: 1andmax_labels: 1 - Multiple answers: use
min_labelsand optionalmax_labels - Ordinal: single-answer cardinality plus
ordered: true; labels are ordered low to high
labels may be a string array or an object mapping each answer to its description. A task may also include instruction and examples, where each example is a [text, answer] pair.
Supported constraint expressions include Implies, Excludes, Cardinality, AtLevel, MinLevel, and MaxLevel. Constraint type names are case-sensitive. Ordinal constraints use these JSON shapes:
exact_level, minimum_level, maximum_level, and bounded_range above are explanatory labels, not constraint fields. Put the corresponding constraint object directly inside the schema’s constraints array. A bounded range is an And containing MinLevel and MaxLevel; there is no BetweenLevel wire type.
The following request combines single-answer, multiple-answer, and ordinal tasks:
choices[0].message.content, the constrained result has this shape (probability values vary by input and checkpoint):
safe, but selecting prompt_injection makes that answer invalid. The constrained decoder therefore selects the lower-probability unsafe answer and a severity of at least high. Constraints enforce a valid joint result; they do not increase or recalibrate the underlying probabilities or confidence.
Always inspect _meta.feasible. A result can be best-effort rather than fully feasible when the schema is contradictory or no retained candidate assignment satisfies every rule.
Structured extraction schema
Structure fields usefield::type::description specifications:
Relation schema
The simplest relation schema is a flat list of relation names:Combined schema
Run multiple tasks over the same text by combining keys:task or task_type.
Example
model value must currently support hosted inference. Use the live model catalog rather
than assuming every Hugging Face checkpoint is available:
Response
The endpoint returns a chat-completion envelope. The GLiNER result is serialized as a JSON string inchoices[0].message.content:
choices[0].message.content as JSON before reading task results. When store=true,
x_fastino.inference_id identifies the persisted inference.
x_fastino.default_schema_applied is true when an encoder request omitted both schema
and response_format and Fastino used the selected model’s catalog default.
Async jobs for very large inputs
Use the async GLiNER interface when a request exceeds one million tokens and may outlast the synchronous timeout. Submit the native GLiNER payload to:text and schema; it also accepts threshold, include_confidence,
and include_spans. A successful submission returns HTTP 202 with job_id, status,
estimated_tokens, and message.
Poll the returned job ID until status is complete or error:
result and token_usage. Jobs are scoped to the authenticated user,
so use the same API key for submission and polling.
Repeated inputs
The endpoint accepts one conversation per request. It does not support the removed native endpoint’stext: string[] batch shape. Send separate requests concurrently when processing
multiple inputs.
Errors
See Cold starts and retries for the shared retry pattern.

