> ## 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.

# Pioneer 快速入门：从注册到首次推理

> 在几分钟内从零完成一次可用的 Pioneer 推理调用。生成 API 密钥、浏览可用模型，并运行你的第一次 NER 预测。

本指南带你走完接入 Pioneer 的最快路径。读完本文后，你将完成一次成功的推理调用，并了解 API 的结构。你只需要一个 Pioneer 账号和一个终端。

<Steps>
  <Step title="注册并获取 API 密钥">
    在 [pioneer.ai](https://pioneer.ai) 上创建账号。

    登录后，前往 **Settings → API Keys** 并生成一个新的密钥。请将其复制到安全的地方 — 一旦关闭对话框，你就再也无法查看它了。

    <Warning>
      不要把 API 密钥提交到版本控制中。请使用环境变量或密钥管理工具，而不要把它硬编码在源文件里。
    </Warning>

    将密钥设置为环境变量，这样下面的示例可以直接运行：

    ```bash theme={null}
    export PIONEER_API_KEY="your_api_key_here"
    ```
  </Step>

  <Step title="列出可用的基础模型">
    在运行推理之前，你可以浏览 Pioneer 上可用的模型。使用 `GET /base-models` 查看完整目录。传入 `?supports_inference=true` 可筛选出可以直接调用的模型，或传入 `?task_type=decoder` 只查看 LLM。

    <CodeGroup>
      ```bash curl theme={null}
      curl https://api.pioneer.ai/base-models?supports_inference=true \
        -H "X-API-Key: $PIONEER_API_KEY"
      ```

      ```python Python theme={null}
      import os
      import requests

      response = requests.get(
          "https://api.pioneer.ai/base-models",
          params={"supports_inference": "true"},
          headers={"X-API-Key": os.environ["PIONEER_API_KEY"]}
      )
      print(response.json())
      ```

      ```javascript JavaScript theme={null}
      const response = await fetch(
        "https://api.pioneer.ai/base-models?supports_inference=true",
        {
          headers: {
            "X-API-Key": process.env.PIONEER_API_KEY
          }
        }
      );
      const data = await response.json();
      console.log(data);
      ```
    </CodeGroup>

    响应中会列出可传给 `/v1/chat/completions` 的模型 ID。例如，`fastino/gliner2-base-v1` 就是用于 NER 任务的 GLiNER 基础模型。
  </Step>

  <Step title="运行第一次推理调用">
    调用 `POST /v1/chat/completions`，传入模型、消息，以及定义你希望提取内容的 schema。下面的示例使用 GLiNER 基础模型从一句话中提取命名实体。

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST https://api.pioneer.ai/v1/chat/completions \
        -H "X-API-Key: $PIONEER_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "model": "fastino/gliner2-base-v1",
          "messages": [
            {"role": "user", "content": "Apple announced the MacBook Pro at WWDC in Cupertino."}
          ],
          "schema": {
            "entities": ["organization", "product", "event", "location"]
          },
          "threshold": 0.5
        }'
      ```

      ```python Python theme={null}
      import os
      import requests

      response = requests.post(
          "https://api.pioneer.ai/v1/chat/completions",
          headers={
              "X-API-Key": os.environ["PIONEER_API_KEY"],
              "Content-Type": "application/json"
          },
          json={
              "model": "fastino/gliner2-base-v1",
              "messages": [{
                  "role": "user",
                  "content": "Apple announced the MacBook Pro at WWDC in Cupertino."
              }],
              "schema": {
                  "entities": ["organization", "product", "event", "location"]
              },
              "threshold": 0.5
          }
      )
      print(response.json())
      ```

      ```javascript JavaScript theme={null}
      const response = await fetch("https://api.pioneer.ai/v1/chat/completions", {
        method: "POST",
        headers: {
          "X-API-Key": process.env.PIONEER_API_KEY,
          "Content-Type": "application/json"
        },
        body: JSON.stringify({
          model: "fastino/gliner2-base-v1",
          messages: [{
            role: "user",
            content: "Apple announced the MacBook Pro at WWDC in Cupertino."
          }],
          schema: {
            entities: ["organization", "product", "event", "location"]
          },
          threshold: 0.5
        })
      });
      const data = await response.json();
      console.log(data);
      ```
    </CodeGroup>

    `schema` 字段告诉模型要查找什么。对于编码器模型（GLiNER），你可以提供：

    * `entities` — 用于 NER 的实体类型字符串列表
    * `classifications` — 用于文本分类的 `{task, labels}` 对象列表
    * `structures` — 用于 JSON 提取的结构定义字典
    * `relations` — 关系定义列表

    对于解码器模型（LLM），省略 `schema` 并发送一条普通的聊天消息即可。

    <Note>
      `model` 可以是像 `fastino/gliner2-base-v1` 这样的基础模型 ID，也可以是某个已完成训练任务的 ID。在微调完模型后，将基础模型 ID 替换为你的任务 ID，就可以从你的自定义模型提供预测。
    </Note>
  </Step>

  <Step title="使用 Anthropic 兼容端点（可选）">
    如果你已经在使用 Anthropic SDK，将其指向 `https://api.pioneer.ai` 并使用你的 Pioneer API 密钥即可。

    <CodeGroup>
      ```bash curl (Anthropic-compatible) theme={null}
      curl -X POST https://api.pioneer.ai/v1/messages \
        -H "X-API-Key: $PIONEER_API_KEY" \
        -H "anthropic-version: 2023-06-01" \
        -H "Content-Type: application/json" \
        -d '{
          "model": "fastino/gliner2-base-v1",
          "max_tokens": 1024,
          "messages": [
            {"role": "user", "content": "Extract entities from: Apple launched the iPhone in San Francisco."}
          ],
          "schema": {"entities": ["organization", "product", "location"]}
        }'
      ```
    </CodeGroup>

    通过 SDK 的 extra-body 选项传递像 `schema` 这样的 Pioneer 特有字段。
  </Step>

  <Step title="启动训练任务（可选）">
    当你准备用自己的数据进行微调时，可以启动一个训练任务。你需要先有一个已上传或已创建的数据集 — 参见[数据集](/cn/concepts/datasets)了解如何创建。

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST https://api.pioneer.ai/felix/training-jobs \
        -H "X-API-Key: $PIONEER_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "model_name": "my-ner-model",
          "base_model": "fastino/gliner2-base-v1",
          "datasets": [{"name": "my-dataset"}],
          "training_type": "lora",
          "nr_epochs": 5,
          "learning_rate": 5e-5
        }'
      ```

      ```python Python theme={null}
      import os
      import requests

      response = requests.post(
          "https://api.pioneer.ai/felix/training-jobs",
          headers={
              "X-API-Key": os.environ["PIONEER_API_KEY"],
              "Content-Type": "application/json"
          },
          json={
              "model_name": "my-ner-model",
              "base_model": "fastino/gliner2-base-v1",
              "datasets": [{"name": "my-dataset"}],
              "training_type": "lora",
              "nr_epochs": 5,
              "learning_rate": 5e-5
          }
      )
      print(response.json())
      # {"id": "uuid-of-training-job", "status": "requested"}
      ```
    </CodeGroup>

    响应中会包含任务的 `id`。轮询 `GET /felix/training-jobs/{id}` 以查看状态。任务状态到达 `complete` 后，就可以在 `/v1/chat/completions` 调用中把任务 ID 用作 `model`。

    任务状态取值：`requested` → `running` → `complete`（或 `failed` / `stopped`）。
  </Step>
</Steps>

## 后续步骤

<CardGroup cols={2}>
  <Card title="微调 NER 模型" icon="tag" href="/guides/fine-tune-ner">
    端到端教程：数据集上传、训练、评估与推理。
  </Card>

  <Card title="微调 LLM" icon="brain" href="/guides/fine-tune-llm">
    使用 LoRA 在你的领域数据上微调 Nemotron 3.5 Lightning。
  </Card>

  <Card title="合成数据" icon="wand-magic-sparkles" href="/guides/synthetic-data">
    无需人工标注即可生成带标签的训练数据。
  </Card>

  <Card title="API 参考" icon="code" href="/cn/api-reference/overview">
    每个端点的完整参考，包含请求和响应 schema。
  </Card>
</CardGroup>
