GLiNER-2

Run Inference

Perform fast, schema-driven entity extraction, text classification, and structured data parsing through the hosted GLiNER 2 inference engine.

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.

schema

object / list

Yes

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

task

enum

Yes

The task you would like to do (extract_entities/classify_text/extract_json)

threshold

float

Optional

Confidence threshold (default 0.5).

Example 1 – Entity Extraction

{
  "task": "extract_entities",
  "text": "Apple CEO Tim Cook announced a partnership with Google in San Francisco.",
  "schema": ["person", "company", "location", "organization", "date"]
}

Response

{
  "result": {
    "entities": {
      "person": [
        "Tim Cook"
      ],
      "company": [
        "Apple",
        "Google"
      ],
      "location": [
        "San Francisco"
      ],
      "organization": [
        "Google"
      ],
      "date": []
    }
  }
}

Example 2 – Text Classification

{
  "task": "classify_text",
  "text": "I absolutely loved this product! It exceeded my expectations.",
  "schema": {
    "categories": ["positive", "negative", "neutral"]
  }
}

Response

{
  "result": {
    "categories": "positive"
  }
}

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

{
  "result": {
    "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