GLiNER-2-XL

Inferencing with GLiNER 2

GLiNER 2 unifies information-extraction tasks in one efficient forward pass and is optimized for CPU-based inference.

POST /gliner-2

Run fast, schema-driven entity extraction, text classification, and structured data parsing through the GLiNER 2 inference endpoint.

Purpose

Use this endpoint to perform Named Entity Recognition, Text Classification, or Structured Data Extraction directly via API without local model setup.

Typical use-cases:

  • Extract entities such as people, organizations, products, or places.

  • Classify text (sentiment, topic, intent).

  • Parse structured fields from unstructured text (invoices, contracts, medical records, etc.).

Endpoint

Headers


Request Body

Field

Type

Required

Description

text

string

Yes

The input text to analyze.

labels

object / list

Yes

Entity labels, class labels, or structured-field schema depending on task.

threshold

float

Optional

Confidence threshold (default 0.5).

Example 1 – Entity Extraction

{
  "text": "Apple CEO Tim Cook announced iPhone 15 in Cupertino yesterday.",
  "labels": ["company", "person", "product", "location"]
}

Response

{
  "entities": {
    "company": ["Apple"],
    "person": ["Tim Cook"],
    "product": ["iPhone 15"],
    "location": ["Cupertino"]
  }
}

Example 2 – Text Classification

{
  "text": "This laptop has great performance but poor battery life.",
  "labels": {"sentiment": ["positive", "neutral", "negative"]}
}

Response

{"sentiment": "negative"}

Example 3 – Structured Extraction

{
  "task": "extract_json",
  "text": "iPhone 15 Pro Max with 256GB storage priced at $1199.",
  "schema": {
    "product": [
      "name::str::Product name",
      "storage::str::Storage capacity",
      "price::str::Price with currency"
    ]
  }
}

Response

{
  "product": [{
    "name": "iPhone 15 Pro Max",
    "storage": "256GB",
    "price": "$1199"
  }]
}

Error Responses

HTTP Code

Error Code

Description

400

INVALID_REQUEST

Missing or malformed fields.

401

UNAUTHORIZED

Missing or invalid token.

500

SERVER_ERROR

Internal inference error.

Best Practices

  • Keep text under 8 KB per call for best latency.

  • Reuse the same model ID for batch requests to leverage warm caching.

  • Use threshold ≥ 0.7 for precision-critical domains (e.g., finance or healthcare).

  • Combine GLiNER 2 output with Fastino Personalization API for user-specific extraction context.

Summary
POST /gliner-2 provides unified, production-ready information extraction through Fastino’s hosted GLiNER 2 engine — efficient, accurate, and LLM-compatible.

On this page