Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.veri.studio/llms.txt

Use this file to discover all available pages before exploring further.

Installation

pip install veri-sdk
Requires Python 3.10 or later.

Quick Start

# Login via CLI (stores credentials at ~/.veri/credentials.json)
veri login --key vk_your_api_key
from veri_sdk import Client

# Auto-reads credentials from ~/.veri/credentials.json
client = Client()

# Or pass explicitly
client = Client(api_key="vk_your_api_key", base_url="https://api.veri.studio")

Resources

The SDK covers all control-plane resources:
  • client.datasets — upload, connect, validate, list, get
  • client.reward_functions — upload, list, get
  • client.training_jobs — create, list, get, cancel, wait

Datasets

Upload a dataset

dataset = client.datasets.upload("math_prompts.jsonl")
print(f"ID: {dataset.id}")
print(f"Source: {dataset.source_type}")

Connect an external dataset

dataset = client.datasets.connect(
    name="gsm8k-train",
    source_type="hf",
    huggingface_dataset="gsm8k",
    huggingface_config={
        "split": "train",
        "column_mapping": {
            "question": "prompt",
            "answer": "label",
        },
    },
)
print(dataset.id)
Supported source_type values are s3, gs, az, hf, postgres, mysql, snowflake, and bigquery.

Validate a connection

result = client.datasets.validate(
    source_type="s3",
    source_uri="s3://my-bucket/prompts.jsonl",
)
print(result["valid"], result.get("num_rows"))

List datasets

datasets = client.datasets.list(limit=10)
for ds in datasets:
    print(f"{ds.id}: {ds.name} ({ds.source_type})")

Reward Functions

Upload a reward function

reward = client.reward_functions.upload("reward.py", format="trl")
print(f"ID: {reward.id}")
print(f"Format: {reward.format}")
Use format="miles" for files that implement async def reward(args, sample, **kwargs) -> float.

List reward functions

rewards = client.reward_functions.list(limit=10)
for rf in rewards:
    print(f"{rf.id}: {rf.name} ({rf.format})")

Get a reward function

reward = client.reward_functions.get("rf_def456")
print(f"Name: {reward.name}")

Training Jobs

Create a job

job = client.training_jobs.create(
    base_model="Qwen/Qwen3-4B",
    dataset_id="ds_abc123",
    reward_function_id="rf_def456",
    output_name="qwen3-4b-math",
    hyperparameters={
        "learning_rate": 1e-6,
        "num_epochs": 1,
        "rollouts_per_prompt": 8,
        "max_response_length": 2048,
        "global_batch_size": 64,
    },
    gpu={"type": "A100-80GB", "count": 1},
    checkpoint_destination={"type": "veri"},
)
print(f"Job ID: {job.id}")
print(f"Status: {job.status}")

Get job status

job = client.training_jobs.get("job_xyz789")
print(f"Status: {job.status}")

List jobs

# All jobs
jobs = client.training_jobs.list()

# Filter by status
running_jobs = client.training_jobs.list(status="running")

# Paginate with cursor
page = client.training_jobs.list(limit=10)
next_page = client.training_jobs.list(limit=10, after=page[-1].id)

Wait for completion

job.wait()  # blocks until completed or failed
print(f"Final status: {job.status}")

Cancel a job

client.training_jobs.cancel("job_xyz789")

Download a completed checkpoint

job = client.training_jobs.get("job_xyz789")
print(job.download_url)

if job.download_url:
    path = job.download(output_dir="downloads")
    print(path)
The current SDK file does not yet include helper methods for the cost and billing endpoints. Use raw HTTP calls or add wrappers if you need them immediately.

Error Handling

try:
    job = client.training_jobs.create(...)
except Exception as e:
    print(f"Request failed: {e}")
The current SDK relies on httpx response errors rather than a custom Veri exception hierarchy.