---
title: "Gliner2 Process"
method: POST
path: "/v1/gliner-2"
tags: ["gliner"]
---

# Gliner2 Process

`POST /v1/gliner-2`

## Request

- Base URL: `https://api.fastino.ai`
- URL: `https://api.fastino.ai/v1/gliner-2`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/docs/v1/gliner-2/post.ts> (a function with typed inputs; its response is checked against the schema)

Process text using GLiNER-2 base model via InferenceService.

``task`` is optional — when omitted the unified schema path is used.
Legacy task names are still accepted but deprecated.

## Request body

- GlinerRequest: Request for GLiNER-2 processing (sync).
  - `format_results` boolean, nullable
  - `include_confidence` boolean, nullable
  - `include_spans` boolean, nullable
  - `schema` union, required: Extraction schema. The flat ``list[str]`` of entity labels is deprecated; use the unified dict shape (``entities`` / ``classifications`` / ``structures`` / ``relations``) for forward compatibility. Deprecated submissions emit ``Deprecation: true`` and ``Sunset: <RFC 7231 date>`` headers.
    - string[]
    - object
  - `task` string, nullable: **Deprecated** legacy task hint. One of: 'extract_entities', 'classify_text', 'extract_json', 'schema'. Omit for the unified GLiNER2 path. Submitting a legacy task value still succeeds but the response carries ``Deprecation: true`` and a ``Sunset`` header.
  - `text` union, required
    - string
    - string[]
  - `threshold` number, nullable
  - `truncate_overflow_text` boolean: Encoder (GLiNER) models only. When the text is longer than the model's max_input_tokens, cut it to fit instead of rejecting the request with input_too_long. Off by default. A response whose input was cut reports x_fastino.truncated: true; entities past the cut are not returned. Token usage still counts the full submitted text. Texts over 50,000 characters are rejected before truncation applies. Not supported for full fine-tuned encoder models, which still reject.

## Response `200`

Successful Response

- GlinerResponse: Response from GLiNER-2 processing.
  - `result` union, required
    - object
    - unknown[]
      - unknown
  - `token_usage` integer, required
  - `x_fastino` FastinoExtension: Fastino-specific extension fields appended to OpenAI-compatible responses. OpenAI's API contract reserves the unprefixed top-level keys (``id``, ``choices``, ``usage``, …); custom data must live under a clearly namespaced key. ``x_fastino`` is that key. Attributes: inference_id: The Fastino-side identifier of the persisted ``inferences`` row associated with this completion. Present when persistence is enabled (``extra_body.store == True``) and the row was successfully recorded; ``None`` for ad-hoc requests that opted out of persistence. The frontend uses this to poll ``GET /inferences/{id}`` for asynchronous judge results without coupling the inference response latency to the judge. default_schema_applied: Whether Fastino supplied the selected encoder model's default because the request did not provide a GLiNER schema. This also applies when ``response_format`` is ``text`` or ``json_object``, since neither contains a schema. truncated: Whether the encoder input was cut to fit the model's ``max_input_tokens`` because the request set ``truncate_overflow_text``. For a batch, at least one text was cut.
    - `default_schema_applied` boolean
    - `inference_id` string, nullable
    - `truncated` boolean

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-12** `43d7e06a824b`: 2 info
  - added the new optional request property `truncate_overflow_text`
  - added the optional property `x_fastino` to the response with the `200` status
- **2026-09-28** `54da122a2879`: 1 info
  - api operation id `gliner2_process_gliner_2_post` removed and replaced with `gliner2_process_v1_gliner_2_post`
- **2026-09-23** `3c6d0570627b`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/changes/v1/gliner-2/post.md)

---

[API](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api.md) - [All operations](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/llms.txt) - [OpenAPI document](https://skmtc.dev/fastino-ai/apis/pioneer-inference-api/revisions/81465e18c1d2?raw)
