Skip to main content
GLiNER uses the OpenAI-compatible model and messages envelope with two GLiNER-specific details:
  • Add a top-level schema describing 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

  1. Create a Fastino account
  2. Get your API key from Settings
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

Each entry accepts only 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 reports constrained_classification in encoder_features from GET /v1/base-models before using this schema. Tasks use cardinality and ordering fields:
  • Single answer: min_labels: 1 and max_labels: 1
  • Multiple answers: use min_labels and optional max_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:
The property names 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:
The endpoint returns the standard chat-completion envelope. After parsing the JSON string in choices[0].message.content, the constrained result has this shape (probability values vary by input and checkpoint):
The example’s independent safety probabilities favor 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 use field::type::description specifications:

Relation schema

The simplest relation schema is a flat list of relation names:
You can also use a dictionary to add descriptions or per-relation configuration:
Do not send relation objects containing head and tail definitions.

Combined schema

Run multiple tasks over the same text by combining keys:
The schema identifies the operation automatically. Do not send task or task_type.

Example

The 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 in choices[0].message.content:
Parse 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:
The request requires 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:
Completed jobs include 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’s text: string[] batch shape. Send separate requests concurrently when processing multiple inputs.

Errors

See Cold starts and retries for the shared retry pattern.
POST /inference has been removed. Do not send its legacy fields such as model_id, text, task, format_results, or is_warmup.

Legacy request migration