> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fastino.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use https://docs.fastino.ai/llms.txt to discover and navigate pages. Use https://docs.fastino.ai/llms-full.txt when you need the complete documentation corpus. Use https://docs.fastino.ai/openapi.json as the source of truth for customer-facing routes. For GLiDE decision inference, call POST https://api.fastino.ai/v1/systemone with model fastino/GLiDE. Create managed config jobs with POST /v1/training/jobs using base_model. Both config and interactive jobs use /v1/training/jobs/{job_id} for their canonical REST lifecycle. For custom training loops, use the supported Tinker-compatible SDK client; its /v1/training/compat/tinker adapter is intentionally absent from OpenAPI and must not be called directly. Auto Train is private access and has no public route; direct interested users to sales@fastino.ai. Do not infer undocumented routes. Read API keys from FASTINO_API_KEY and never embed credentials in code, logs, or reports.

# Fine-tune GLiNER

> Prepare a GLiNER dataset, create a managed config job, and monitor it through checkpoints and completion.

This guide creates a `config` training job. You provide a ready dataset and
training settings; Fastino runs the training loop.

## Before you begin

Set `FASTINO_API_KEY` as shown in the [Training API overview](/training). The
examples send it in the `X-API-Key` header and use `jq` to read JSON responses.

## 1. Choose the task

<CardGroup cols={2}>
  <Card title="Extraction" icon="highlighter">
    Train GLiNER to find labeled spans such as people, products, or locations.
    Prepare `text` and `entities` rows and upload the dataset as NER data.
  </Card>

  <Card title="Classification" icon="tags">
    Train GLiNER to assign one or more labels to text. Prepare `text` with
    `label` or `labels` rows and upload the dataset as classification data.
  </Card>
</CardGroup>

Keep one row shape throughout each JSONL file. Follow
[Prepare and upload training datasets](/concepts/datasets) for the exact GLiNER
JSONL formats, upload-URL request, file upload, processing request, and readiness
check. Continue only after the dataset version reports `ready`.

## 2. Query trainable models

Do not hard-code a base model from an old example. Query the live catalog
immediately before creating the job:

```bash theme={null}
curl -sS "https://api.fastino.ai/v1/base-models?supports_training=true" \
  -H "X-API-Key: $FASTINO_API_KEY" | jq
```

Choose a GLiNER model that supports your task and desired training type. Copy
its exact ID for the native Training API's `base_model` field.

## 3. Create a config job

Replace the catalog model, dataset name, and version below.

```bash theme={null}
curl -sS -X POST "https://api.fastino.ai/v1/training/jobs" \
  -H "X-API-Key: $FASTINO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model_name": "support-request-extractor",
    "base_model": "BASE_MODEL_ID_FROM_CATALOG",
    "datasets": [
      {
        "name": "READY_DATASET_NAME",
        "version": "VERSION_NUMBER"
      }
    ],
    "training_type": "lora"
  }' | tee training-job.json
```

The response is the created job record. Save its `id`:

```bash theme={null}
export TRAINING_JOB_ID="$(jq -r '.id' training-job.json)"
test "$TRAINING_JOB_ID" != "null"
```

See the [create-job API reference](/api-reference/training-jobs/create) for
optional config-job fields.

## 4. Poll the job

Poll `GET /v1/training/jobs/{job_id}` until `is_terminal_status` is `true`:

```bash theme={null}
while true; do
  if ! JOB="$(
    curl --fail-with-body -sS \
      "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID" \
      -H "X-API-Key: $FASTINO_API_KEY"
  )"; then
    echo "Could not read training job" >&2
    exit 1
  fi

  echo "$JOB" | jq -e 'has("is_terminal_status")' >/dev/null || {
    echo "Training response has no terminal-state field" >&2
    exit 1
  }

  echo "$JOB" | jq '{
    normalized_status,
    is_terminal_status,
    error_message,
    is_deployable,
    deployability_reason
  }'

  [ "$(echo "$JOB" | jq -r '.is_terminal_status')" = "true" ] && break
  sleep 10
done
```

For the config-job statuses and terminal-state guidance, see the
[Training API overview](/training#config-job-lifecycle).

## 5. Inspect logs and checkpoints

Read logs when you need progress or failure details:

```bash theme={null}
curl -sS \
  "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID/logs" \
  -H "X-API-Key: $FASTINO_API_KEY" | jq
```

List the checkpoints Fastino created:

```bash theme={null}
curl -sS \
  "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID/checkpoints" \
  -H "X-API-Key: $FASTINO_API_KEY" | tee training-checkpoints.json | jq

export CHECKPOINT_ID="$(
  jq -r '[.checkpoints[] | select(.is_deployable == true)] | first | .id // empty' \
    training-checkpoints.json
)"
test -n "$CHECKPOINT_ID"
```

See
[logs](/api-reference/training-jobs/logs) and
[checkpoints](/api-reference/training-jobs/checkpoints) for their response
fields.

## 6. Deploy the trained model

Check the completed job's `is_deployable` and `deployability_reason` fields,
then deploy the selected deployable checkpoint:

```bash theme={null}
curl --fail-with-body -sS -X POST \
  "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID/checkpoints/$CHECKPOINT_ID/deploy" \
  -H "X-API-Key: $FASTINO_API_KEY" | jq
```

Poll the job again until its deployment state is ready. The training job ID is
the model identifier used for hosted inference.

## 7. Run GLiNER inference

```bash theme={null}
curl --fail-with-body -sS \
  "https://api.fastino.ai/v1/chat/completions" \
  -H "Authorization: Bearer $FASTINO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"$TRAINING_JOB_ID\",
    \"messages\": [
      {
        \"role\": \"user\",
        \"content\": \"Ada Lovelace worked in London.\"
      }
    ],
    \"schema\": {
      \"entities\": [
        {\"name\": \"person\"},
        {\"name\": \"location\"}
      ]
    }
  }" | jq -r '.choices[0].message.content | fromjson'
```

<CardGroup cols={2}>
  <Card title="Call GLiNER" icon="braces" href="/inference/chat-completions">
    Use GLiNER for extraction or classification through
    `POST /v1/chat/completions`.
  </Card>

  <Card title="Install the GLiNER agent skill" icon="bot" href="/concepts/gliner-agent-skill">
    Optionally give Cursor, Claude Code, or Codex the hosted GLiNER workflow.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.