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

# Training API quickstart

> Start a managed training job or an application-controlled training loop, then verify its canonical job ID.

This quickstart covers both Training API paths. Use managed training when you
want Fastino to run the loop. Use a custom training loop when your application
must control sampling, rewards, and model updates.

## 1. Authenticate

1. Create a [Fastino account](https://agent.fastino.ai/).
2. Open [API keys](https://agent.fastino.ai/api-keys).
3. Create a key and copy it when shown.

Store the key in an environment variable:

<CodeGroup>
  ```bash macOS/Linux theme={null}
  export FASTINO_API_KEY="fast_sk_..."
  ```

  ```powershell Windows theme={null}
  $env:FASTINO_API_KEY = "fast_sk_..."
  ```
</CodeGroup>

Send this key as `X-API-Key: $FASTINO_API_KEY`. See
[Authentication](/authentication) for the complete authentication contract.

## 2. Choose a path

| Goal | Path |
| - | - |
| Provide data and configuration, then let Fastino run training | [Managed training](#managed-training) |
| Control sampling, rewards, and updates in your application | [Custom training loop](#custom-training-loop) |

## Managed training

### 3. Prepare a dataset

[Upload and process a training dataset](/concepts/datasets), then wait until its
version is `ready`.

### 4. Choose a model

Query the live catalog before submission:

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

Save the selected model ID.

### 5. Create the job

```bash theme={null}
curl -X POST "https://api.fastino.ai/v1/training/jobs" \
  -H "X-API-Key: $FASTINO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "model_name": "my-trained-model",
    "base_model": "MODEL_ID_FROM_CATALOG",
    "datasets": [
      {"name": "my-ready-dataset", "version": "VERSION_NUMBER"}
    ],
    "training_type": "lora"
  }'
```

Save the returned `id`. It is the `job_id` used by every job-specific route.
Reuse the same `Idempotency-Key` only when retrying this exact create request.

### 6. Poll the job

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

For config jobs:

* `status` is the persisted lifecycle value, such as `errored`.
* `normalized_status` is the stable polling value, such as `failed`.
* `is_terminal_status` tells your client when to stop polling.
* `error_message` describes a failure when available.

Continue until `is_terminal_status` is `true`, then inspect the final status,
checkpoints, logs, and deployment eligibility.

## Custom training loop

Custom training loops require team access and Python 3.11 or later. The
supported SDK client talks to Fastino's hidden HTTP compatibility adapter. Use
the client methods below. Do not construct adapter requests.

### 3. Install the tested client

<CodeGroup>
  ```bash uv theme={null}
  uv init fastino-training
  cd fastino-training
  uv add "tinker==0.33.1"
  ```

  ```bash pip theme={null}
  mkdir fastino-training && cd fastino-training
  python -m venv .venv
  source .venv/bin/activate
  pip install "tinker==0.33.1"
  ```

  ```powershell pip · Windows theme={null}
  mkdir fastino-training
  cd fastino-training
  py -m venv .venv
  .\.venv\Scripts\Activate.ps1
  pip install "tinker==0.33.1"
  ```
</CodeGroup>

### 4. Configure the client

`TINKER_CREDENTIAL_CMD` runs for every token request and must print one
nonempty credential.

<CodeGroup>
  ```bash macOS/Linux theme={null}
  export TINKER_BASE_URL="https://api.fastino.ai/v1/training/compat/tinker"
  export TINKER_CREDENTIAL_CMD='printf "%s\n" "$FASTINO_API_KEY"'
  ```

  ```powershell Windows theme={null}
  $env:TINKER_BASE_URL = "https://api.fastino.ai/v1/training/compat/tinker"
  $env:TINKER_CREDENTIAL_CMD = 'powershell -NoProfile -Command "[Console]::Out.WriteLine($env:FASTINO_API_KEY)"'
  ```
</CodeGroup>

Use a normal Fastino key beginning with `fast_sk_`. Credentials beginning with
`tml-` are rejected. Do not set `TINKER_API_KEY`.

### 5. Choose an enabled model

Call `ServiceClient.get_server_capabilities()` and select a model and LoRA rank
from its response:

<CodeGroup>
  ```bash macOS/Linux theme={null}
  export FASTINO_TRAINING_MODEL="<model from capabilities>"
  export FASTINO_TRAINING_LORA_RANK="<supported rank>"
  ```

  ```powershell Windows theme={null}
  $env:FASTINO_TRAINING_MODEL = "<model from capabilities>"
  $env:FASTINO_TRAINING_LORA_RANK = "<supported rank>"
  ```
</CodeGroup>

### 6. Create the job and sample

Create `quickstart.py`:

```python theme={null}
import os

import tinker


service_client = tinker.ServiceClient()
outcome = "errored"
try:
    capabilities = service_client.get_server_capabilities()
    print(capabilities)

    training_client = service_client.create_lora_training_client(
        base_model=os.environ["FASTINO_TRAINING_MODEL"],
        rank=int(os.environ["FASTINO_TRAINING_LORA_RANK"]),
    )

    job_id = training_client.get_info().model_data.model_id
    print(f"TRAINING_JOB_ID={job_id}")

    checkpoint = training_client.save_weights_for_sampler(
        "quickstart-sampler"
    ).result()
    sampling_client = service_client.create_sampling_client(
        model_path=checkpoint.path
    )

    tokenizer = sampling_client.get_tokenizer()
    prompt_tokens = tokenizer.apply_chat_template(
        conversation=[
            {
                "role": "user",
                "content": "Explain the purpose of a reward function in one sentence.",
            }
        ],
        add_generation_prompt=True,
        return_dict=False,
    )
    result = sampling_client.sample(
        prompt=tinker.types.ModelInput.from_ints(prompt_tokens),
        num_samples=1,
        sampling_params=tinker.types.SamplingParams(max_tokens=64),
    ).result()

    print(tokenizer.decode(result.sequences[0].tokens))
except KeyboardInterrupt:
    outcome = "interrupted"
    raise
else:
    outcome = "success"
finally:
    service_client.close(outcome).result()
```

Run the script:

```bash theme={null}
python quickstart.py
```

Copy the value printed after `TRAINING_JOB_ID=`.

### 7. Verify the canonical job

<CodeGroup>
  ```bash macOS/Linux theme={null}
  export TRAINING_JOB_ID="<ID printed by quickstart.py>"
  curl --fail-with-body \
    -H "X-API-Key: $FASTINO_API_KEY" \
    "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID"
  ```

  ```powershell Windows theme={null}
  $env:TRAINING_JOB_ID = "<ID printed by quickstart.py>"
  Invoke-RestMethod `
    -Headers @{ "X-API-Key" = "$env:FASTINO_API_KEY" } `
    -Uri "https://api.fastino.ai/v1/training/jobs/$env:TRAINING_JOB_ID"
  ```
</CodeGroup>

The response describes the same job created by
`create_lora_training_client(...)`. Continue with the SDK client for model
operations and use the canonical jobs API for documented job reads.

## Continue

<CardGroup cols={3}>
  <Card title="Datasets" icon="database" href="/concepts/datasets">
    Prepare and validate training data.
  </Card>

  <Card title="Jobs reference" icon="book" href="/api-reference/training-jobs/create">
    Review the complete request and response contract.
  </Card>

  <Card title="Training loop" icon="repeat-2" href="/training/training-loop">
    Add rewards, updates, and recovery to a custom loop.
  </Card>
</CardGroup>


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