# RSI Labs docs # Documentation URL: https://rsi-labs.ai/docs Train, serve and continuously improve models you own, through one API. Start with a single call, then fine-tune, evaluate and deploy. All docs as one file: https://docs.rsi-labs.ai/llms.txt ## Get started. Make your first call, fine-tune a model and deploy it. - [Quickstart](/docs/quickstart): Call a model, run a fine-tune and deploy it in about 15 minutes. - [Inference quickstart](/docs/inference): Call open-weight models through an OpenAI-compatible API. - [Models and pricing](/docs/models): Supported open-weight models, context limits and prices. ## Post-train. Teach open-weight models from examples (fine-tuning) or from rewards (reinforcement learning). - [Your first SFT run](/docs/sft): Fine-tune an open-weight model on your own examples with LoRA. - [Your first RL run](/docs/rl): Improve a model with reinforcement learning and your reward function. ## Improve and deploy. Promote only what wins, and run it wherever your data lives. - [Private evals and promotion](/docs/evals): Benchmark candidates on private evals and promote on a significant win. - [Deploy and serve](/docs/deploy-and-serve): Turn a checkpoint into a dedicated, autoscaling endpoint. - [Deploy anywhere](/docs/deploy-anywhere): Run the same API fully managed, in your VPC or on-prem. --- # Quickstart URL: https://rsi-labs.ai/docs/quickstart Make your first call, fine-tune an open-weight model on your own examples and deploy it behind an OpenAI-compatible endpoint, in about 15 minutes. ## Get an API key Create a key in the Console, then store it as an environment variable. Keys are secret: keep them out of source control and client-side code. ```bash title="Terminal" export RSI_API_KEY="your-api-key" ``` ## Install the SDK The Python SDK covers training, sampling and deployments. For inference you can also use the OpenAI SDK you already have. ```bash pip install rsi openai ``` ```bash npm install openai ``` > **Note:** Package names, hosts and environment variables such as `rsi` and `RSI_API_KEY` are placeholders until the SDK ships. ## Make your first call Every model is served through an OpenAI-compatible API. Point your client at `https://api.rsi-labs.ai/v1` and pick a model from [Models and pricing](/docs/models). ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.rsi-labs.ai/v1", api_key=os.environ["RSI_API_KEY"], ) resp = client.chat.completions.create( model="Qwen3.8-27B", messages=[{"role": "user", "content": "Hello!"}], ) print(resp.choices[0].message.content) ``` ```ts import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.rsi-labs.ai/v1", apiKey: process.env.RSI_API_KEY, }); const resp = await client.chat.completions.create({ model: "Qwen3.8-27B", messages: [{ role: "user", content: "Hello!" }], }); console.log(resp.choices[0].message.content); ``` ```bash curl https://api.rsi-labs.ai/v1/chat/completions \ -H "Authorization: Bearer $RSI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "Qwen3.8-27B", "messages": [{"role": "user", "content": "Hello!"}]}' ``` ## Fine-tune a model Open a training session, create a model with a LoRA adapter and train it on batches of your examples. `train_step` runs the forward pass, backward pass and optimizer update together. Each example is a chat conversation in the same format as the API. See [Your first SFT run](/docs/sft) for data preparation. ```python title="train.py" import os import rsi client = rsi.Client(api_key=os.environ["RSI_API_KEY"]) with client.session() as session: model = session.create_model( base_model="Qwen3.6-35B", lora=rsi.LoraConfig(rank=16), ) for batch in batches: model.train_step(batch, lr=1e-4, loss_fn="cross_entropy") checkpoint = model.save_weights("support-v1", mode="inference") ``` ## Deploy your model Turn the saved checkpoint into a dedicated deployment. With `wait=True` the call returns once the endpoint is ready. ```python title="deploy.py" deployment = client.create_deployment( checkpoint=checkpoint, unified_replicas=1, wait=True, ) print(deployment.base_url, deployment.model) ``` ## Call your model Your deployment speaks the same API as before, so switching an app over is a one-line change to the base URL and model name. ```python title="serve.py" inference = OpenAI( base_url=deployment.base_url, api_key=os.environ["RSI_API_KEY"], ) resp = inference.chat.completions.create( model=deployment.model, messages=[{"role": "user", "content": "Where is my order?"}], ) ``` ## Next steps - [Your first RL run](/docs/rl): Improve your model with rewards instead of examples. - [Private evals and promotion](/docs/evals): Promote a new checkpoint only when it wins on your evals. - [Deploy anywhere](/docs/deploy-anywhere): Run the same setup in your VPC or on-prem. --- # Models and pricing URL: https://rsi-labs.ai/docs/models Open-weight models you can post-train and serve, with context limits and prices. Prices are in USD per 1M tokens. ## Supported models Every model below can be post-trained, with reinforcement learning or supervised fine-tuning. Models marked "Serve on API" are also available on the per-token inference API; the last two are serve-only. | Model | Model ID | Maker | Post-training context | Serve on API | | --- | --- | --- | --- | --- | | DeepSeek V4.1 Flash | `DeepSeek-V4.1-Flash` | DeepSeek | 262k | Yes | | GLM-5.3 | `GLM-5.3` | Z.ai | 262k | Yes | | GLM-5.3 Flash | `GLM-5.3-Flash` | Z.ai | 262k | Yes | | Qwen3.8 27B | `Qwen3.8-27B` | Alibaba Qwen | 262k | Yes | | Nemotron 3.5 Super VL | `Nemotron-3.5-Super-VL` | NVIDIA | 262k | Yes | | Kimi K2.6 | `Kimi-K2.6` | Moonshot AI | 32k or 262k | — | | Qwen3.5 397B | `Qwen3.5-397B` | Alibaba Qwen | 262k | — | | Qwen3.6 35B | `Qwen3.6-35B` | Alibaba Qwen | 262k | — | | DeepSeek V4.1 Flash (1017) | `DeepSeek-V4.1-Flash-1017` | DeepSeek | 262k | Yes | | DeepSeek V4 Flash (0731) | `DeepSeek-V4-Flash-0731` | DeepSeek | 262k | — | | GLM-5.2 | `GLM-5.2` | Z.ai | 32k or 262k | — | | Qwen3.5 9B | `Qwen3.5-9B` | Alibaba Qwen | 262k | — | | Qwen3.5 122B | `Qwen3.5-122B` | Alibaba Qwen | 262k | — | | Qwen3.8 Flash Next | `Qwen3.8-Flash-Next` | Alibaba Qwen | 262k | — | | Nemotron 3.5 Lightning 30B | `Nemotron-3.5-Lightning-30B` | NVIDIA | 262k | — | | Muse Spark Open 816B | On request | — | On request | — | Need another open-weight model? We'll add it, priced on request. [Contact sales](/contact-sales). ## Inference pricing | Model | Prompt | Cached | Completion | | --- | --- | --- | --- | | DeepSeek V4.1 Flash | $0.12 | $0.0024 | $0.48 | | DeepSeek V4.1 Flash (1017) | $0.12 | $0.0024 | $0.48 | | GLM-5.3 | $1.12 | $0.208 | $3.52 | | GLM-5.3 Flash | $0.12 | $0.024 | $0.40 | | Nemotron 3.5 Super VL | $0.15 | $0.02 | $0.45 | | Qwen3.8 27B | $0.10 | $0.02 | $2.00 | USD per 1M tokens. Preview rates, subject to change. ## Post-training and sampling pricing | Model | Context | Prompt | Cached | Completion | Training | | --- | --- | --- | --- | --- | --- | | DeepSeek V4 Flash (0731) | 262k | $1.50 | $0.30 | $3.00 | $8.00 | | DeepSeek V4.1 Flash | 262k | $1.50 | $0.30 | $3.00 | $12.00 | | DeepSeek V4.1 Flash (1017) | 262k | $1.50 | $0.30 | $3.00 | $12.00 | | GLM-5.2 | 32k | $1.46 | $0.292 | $3.67 | $4.40 | | GLM-5.2 | 262k | $5.14 | $1.028 | $12.84 | $15.41 | | GLM-5.3 Flash | 262k | $0.76 | $0.15 | $1.90 | $5.02 | | GLM-5.3 | 262k | $3.50 | $0.70 | $10.00 | $14.00 | | Kimi K2.6 | 32k | $1.22 | $0.244 | $3.06 | $3.67 | | Kimi K2.6 | 262k | $4.28 | $0.856 | $10.70 | $12.84 | | Muse Spark Open 816B | — | $3.50 | $0.70 | $10.00 | $14.00 | | Nemotron 3.5 Lightning 30B | 262k | $0.30 | $0.06 | $0.80 | $1.00 | | Nemotron 3.5 Super VL | 262k | $1.50 | $0.30 | $2.00 | $2.00 | | Qwen3.5 9B | 262k | $0.66 | $0.132 | $1.99 | $1.46 | | Qwen3.5 122B | 262k | $1.00 | $0.20 | $3.00 | $4.00 | | Qwen3.5 397B | 262k | $3.32 | $0.664 | $8.30 | $10.00 | | Qwen3.6 35B | 262k | $0.33 | $0.066 | $0.82 | $1.00 | | Qwen3.8 27B | 262k | $1.80 | $0.36 | $5.50 | $4.10 | | Qwen3.8 Flash Next | 262k | $0.80 | $0.16 | $2.00 | $8.00 | USD per 1M tokens. Prompt, cached and completion are sampling prices. Checkpoint storage billed at $0.10 / GB / month. Longer context and additional models priced on request. Prompt, cached and completion are sampling prices. Checkpoint storage is billed at $0.10 per GB per month. Preview rates, subject to change. ## VPC and on-prem pricing In your VPC or data center you pay a platform fee and keep your existing hardware or cloud spend. [Contact sales](/contact-sales) for a quote. ## Next steps - [Inference quickstart](/docs/inference): Make your first inference call. - [Your first SFT run](/docs/sft): Fine-tune one of these models. --- # Inference quickstart URL: https://rsi-labs.ai/docs/inference Call open-weight models through an OpenAI-compatible API. If your app already uses the OpenAI SDK, change the base URL and model name and you're done. > **Note:** Package names, hosts and environment variables such as `rsi` and `RSI_API_KEY` are placeholders until the SDK ships. ## Choose a model Pick a model ID from [Models and pricing](/docs/models). Use the model ID from that table, for example `Qwen3.8-27B`. ## Send a request Authenticate with your API key as a bearer token. ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.rsi-labs.ai/v1", api_key=os.environ["RSI_API_KEY"], ) resp = client.chat.completions.create( model="Qwen3.8-27B", messages=[{"role": "user", "content": "Hello!"}], ) print(resp.choices[0].message.content) ``` ```ts import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.rsi-labs.ai/v1", apiKey: process.env.RSI_API_KEY, }); const resp = await client.chat.completions.create({ model: "Qwen3.8-27B", messages: [{ role: "user", content: "Hello!" }], }); console.log(resp.choices[0].message.content); ``` ```bash curl https://api.rsi-labs.ai/v1/chat/completions \ -H "Authorization: Bearer $RSI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "Qwen3.8-27B", "messages": [{"role": "user", "content": "Hello!"}]}' ``` ## Stream responses Set `stream=True` to receive tokens as they are generated. ```python stream = client.chat.completions.create( model="Qwen3.8-27B", messages=[{"role": "user", "content": "Write a haiku."}], stream=True, ) for chunk in stream: if chunk.choices: print(chunk.choices[0].delta.content or "", end="") ``` ## Use tools Pass tool definitions in the OpenAI format. The model returns tool calls for your code to run. ```python tools = [{ "type": "function", "function": { "name": "get_order_status", "parameters": {"type": "object", "properties": {"order_id": {"type": "string"}}}, }, }] resp = client.chat.completions.create(model="Qwen3.8-27B", messages=messages, tools=tools) ``` ## Limits and errors - Requests over your rate limit return `429`. Retry with exponential backoff. - Requests longer than a model's context window are rejected; see the context column in [Models and pricing](/docs/models). - Limits depend on your plan and are shown in the Console. ## Next steps - [Your first SFT run](/docs/sft): Fine-tune a model on your own examples. - [Deploy and serve](/docs/deploy-and-serve): Serve your own checkpoint. --- # Your first SFT run URL: https://rsi-labs.ai/docs/sft Teach an open-weight model your task from examples. Supervised fine-tuning is the fastest way to a specialist model, and the usual starting point before reinforcement learning. ## Prepare your examples Write each example as a chat conversation in JSONL, one per line, ending with the assistant reply you want the model to learn. Start with a few hundred high-quality examples from real traffic. ```json title="train.jsonl" { "messages": [ { "role": "user", "content": "Where is my order?" }, { "role": "assistant", "content": "Let me check that for you." } ] } ``` ## Choose an adapter | Option | When to use it | | --------------------- | --------------------------------------------------------------------------------- | | LoRA, rank 8 to 32 | Most tasks. Fast, cheap, and many adapters can share one base model when served. | | LoRA with unembedding | New output formats or vocabulary-heavy tasks. | | Full-weight | Large datasets and deep behavior changes. Slower and served as a dedicated model. | ## Train Open a session, create the model and loop over batches of examples. Group examples into batches of similar length for efficiency. ```python title="train.py" import os import rsi client = rsi.Client(api_key=os.environ["RSI_API_KEY"]) with client.session() as session: model = session.create_model( base_model="Qwen3.6-35B", lora=rsi.LoraConfig(rank=16), ) for step, batch in enumerate(batches): result = model.train_step(batch, lr=1e-4, loss_fn="cross_entropy") model.log({"loss": result.loss}) checkpoint = model.save_weights("support-v1", mode="inference") ``` ## Track metrics Values passed to `model.log()` appear as charts in the Console. Watch training loss alongside a held-out set, and stop when the held-out loss stops improving. ## Save and deploy Save with `mode="inference"` and follow [Deploy and serve](/docs/deploy-and-serve) to put the model behind an endpoint. ## Next steps - [Your first RL run](/docs/rl): Go further with rewards. - [Private evals and promotion](/docs/evals): Check the new model on private evals. --- # Your first RL run URL: https://rsi-labs.ai/docs/rl Improve a model with rewards instead of examples. Sample several answers per prompt, score them, and push the model toward the better ones. ## Define the task and reward An environment says what the model sees and how its answer scores. Start simple and verifiable: exact match, unit tests passing, or a grader model you trust. ```python from rsi.forge import rl class Math(rl.Env): def reset(self, row): return [{"role": "user", "content": row["question"]}] def reward(self, traj, row): return float(extract_answer(traj.final_text) == row["answer"]) ``` ## Run the loop The rollout engine samples a group of answers per question from the model's live weights; the trainer scores them, turns rewards into advantages (each answer's reward minus its group's mean), and updates the model. Groups where every answer scored the same carry no signal and are skipped. ```python with client.session(run="math-rl") as session: model = session.create_model("Qwen3.8-27B", lora=rsi.LoraConfig(rank=16)) engine = rl.RolloutEngine(model, env=Math, budget=rl.Budget(max_turns=1, segment_tokens=4096)) trainer = rl.AsyncTrainer( engine=engine, optimizer=rl.Adam(lr=4e-5, schedule=rl.cosine(warmup=10)), groups_per_step=16, group_size=8, loss=rl.CISPO(), max_staleness=2, ) for step in trainer.run(questions, steps=200): model.log({"reward/mean": step.metrics["reward/mean"]}) if step.n % 50 == 49: model.save_weights(f"step-{step.n + 1}") ``` Sampling keeps running while the model trains. `max_staleness` bounds how many updates old a sampled answer may be when it is trained on; set it to 0 for strictly on-policy training. ## Agents with tools Give the environment tools and the model can call them. Each tool's schema comes from its type hints and docstring; the default turn handler runs the calls (in parallel) and returns their results to the model until it answers. ```python @rl.tool def search(query: str) -> str: """Search the knowledge base. Args: query: What to look for. """ return kb.search(query) class Support(rl.Env): tools = (search,) def reset(self, row): return [{"role": "user", "content": row["ticket"]}] def reward(self, traj, row): return grade(traj.final_text, row["resolution"]) ``` Each environment class gets a fresh instance per rollout. Raise `rl.InfrastructureError` when your side fails (a sandbox or service is down): the run stops instead of training the model on the outage. ## Settings that matter | Setting | What it controls | | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------- | | `rl.Budget` | Turns, generated tokens, context tokens and tokens per turn for each rollout | | `rl.Truncation` | How rollouts cut off by the budget train: zero reward (default), their own reward, or not at all | | `max_staleness`, `rl.Schedule` | How far sampling may run ahead of training, and how many rollouts run at once | | `loss` | `rl.CISPO()` (default), `rl.PPO()`, `rl.ImportanceSampling()` or `rl.DRO()`, each with `normalize` = token, sequence or sum | | `advantage` | `rl.GroupCentered()` (default), `rl.Batchwise()`, or any function of the rewards | | `environment_timeout` | Stops a stuck environment; its rollout is dropped, not scored | ## Long runs Step and evaluation metrics appear on the run's page in the Console as training goes. For runs that take hours, add recovery and evaluation: ```python trainer = rl.AsyncTrainer( engine=engine, optimizer=rl.Adam(lr=4e-5), groups_per_step=16, group_size=8, checkpoint=rl.Checkpointing("runs/math-rl", weights_every=20), evaluator=rl.Evaluator(holdout, every=20, group_size=4), sinks=[rl.WandbSink(wandb_run)], # optional ) ``` - Every 20 steps the trainer saves the weights and optimizer state and records where the run is. If the process stops, run the same script again: it continues from that step with the same plan. A `SIGTERM` saves and stops cleanly. - Rollouts that were in flight are dropped by default. Set `recovery = "stateless"` on the environment to rerun them, or `"snapshot"` (with `snapshot` and `restore`) to continue them where they were. - The evaluator runs the held-out rows against a saved copy of the weights in a separate session while training continues, plus a final evaluation at the end. Held-out rows are never trained on. ## Under the hood The library is built on Layer 1 calls you can use directly. One step by hand: sample a group, score it, and train on the sampled tokens with their advantages. ```python groups = model.sample(model_input=[[{"role": "user", "content": q}] for q in questions], num_samples=8, max_tokens=4096) data = [] for samples, answer in zip(groups, answers): rewards = [float(extract_answer(s.text) == answer) for s in samples] baseline = sum(rewards) / len(rewards) for s, r in zip(samples, rewards): p, n = len(s.prompt_token_ids), len(s.tokens) ids = s.prompt_token_ids + s.tokens data.append({ "input_ids": ids, "target_tokens": ids[1:] + [0], "old_logprobs": [0.0] * (p - 1) + s.logprobs + [0.0], "advantages": [0.0] * (p - 1) + [r - baseline] * n + [0.0], }) model.train_step(data, lr=4e-5, loss_fn="importance_sampling") ``` ## Evaluate and save Save checkpoints as you go and compare them on [private evals](/docs/evals). ## Next steps - [Private evals and promotion](/docs/evals): Promote the run only when it wins. - [Deploy and serve](/docs/deploy-and-serve): Deploy the trained checkpoint. --- # Private evals and promotion URL: https://rsi-labs.ai/docs/evals Benchmark every candidate against the model in production on your private evals, and promote it only on a statistically significant win. ## Define private evals A suite is a held-out set of prompts from your own traffic, plus graders that score what matters to your business rather than public leaderboards. A suite holds up to 500 examples and 10 graders. ```python import rsi suite = client.evals.create_suite( name="support-private-v3", prompts=[ {"prompt": "Where is my order #4512?", "reference": "tracking link"}, {"messages": conversation, "reference": "refund issued"}, ], graders=[ "contains", rsi.Judge("resolution", "Resolves the customer's issue without asking them to repeat details."), rsi.Judge("policy", "Follows the refund policy and never promises what it can't do."), ], ) ``` Each example is a prompt string, a list of chat messages, or a dict with `prompt` or `messages` and an optional `reference` (the expected answer). | Grader | Scores | | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `"exact_match"` | 1 if the answer equals the reference (case and spacing ignored), else 0 | | `"contains"` | 1 if the answer contains the reference (case ignored), else 0 | | `"json_valid"` | 1 if the answer parses as JSON, else 0 | | `rsi.Judge(name, rubric, model=None)` | A model reads the rubric, the conversation, the reference and the answer, and scores 0 to 1. The judge defaults to the baseline's base model. | `exact_match` and `contains` need a reference on every example. ## Run a candidate against production Each run answers every prompt with the candidate and with the baseline, using the same messages and the same decoding (temperature 0 by default), so the comparison is fair. The candidate and baseline can each be a checkpoint, a deployment, a live model or a base model. ```python run = client.evals.run( candidate=checkpoint, baseline=deployment, suite=suite, ) print(run.metrics, run.significant_win) ``` Answers and judge calls are billed as inference tokens, the same as `chat_complete`. ## Read the result - `run.metrics` maps each grader to the candidate's and baseline's mean scores, the difference and a p-value. - `significant_win` is true only if the candidate is better with statistical significance (p < 0.05, paired permutation test) on at least one grader, and significantly worse on none. - `client.evals.get_run(run.id, include_examples=True)` returns every answer and score side by side. ```python for name, m in run.metrics.items(): print(f"{name}: {m.baseline:.2f} -> {m.candidate:.2f} (p={m.p_value:.3f})") ``` ## Promote Promotion swaps the checkpoint behind the same endpoint, so your apps keep working without changes. ```python if run.significant_win: client.promote(deployment.id, checkpoint=checkpoint) ``` > **Note:** Dedicated deployments are enabled per account during the preview. Without one, compare against an earlier checkpoint or the base model: `baseline=previous_checkpoint`, or the base model's name. ## Close the loop Production traces and feedback become the next training set. Retrain on them, check each candidate against your evals and promote the winners to ship improvements on a regular cadence. ## Next steps - [Deploy and serve](/docs/deploy-and-serve): Run the promoted model behind an endpoint. - [Your first RL run](/docs/rl): Train the next candidate with RL. --- # Deploy and serve URL: https://rsi-labs.ai/docs/deploy-and-serve Turn a checkpoint into a dedicated, autoscaling endpoint that speaks the OpenAI API. > **Note:** Dedicated deployments are enabled per account during the preview: [contact sales](/contact-sales) to turn them on. Until then, deployment calls return `NOT_ENABLED`; you can still chat with a saved checkpoint using `client.chat_complete(checkpoint=...)`. ## Save an inference checkpoint Deployments serve checkpoints saved with `mode="inference"`. ```python checkpoint = model.save_weights("support-v1", mode="inference") ``` ## Create a deployment `create_deployment()` starts replicas and returns the base URL and model name to call. ```python title="deploy.py" deployment = client.create_deployment( checkpoint=checkpoint, unified_replicas=1, wait=True, ) print(deployment.base_url, deployment.model) ``` ## Call it Use any OpenAI-compatible client. ```python title="serve.py" inference = OpenAI( base_url=deployment.base_url, api_key=os.environ["RSI_API_KEY"], ) resp = inference.chat.completions.create( model=deployment.model, messages=[{"role": "user", "content": "Where is my order?"}], ) ``` ## Scale and monitor Set the number of replicas with `scale_on_target()` (0 stops serving but keeps the deployment) and check replica hours with `get_deployment_usage()`. To serve a newer checkpoint behind the same URL, use `client.promote()`. ```python usage = client.get_deployment_usage("dep_7Hq2") client.scale_on_target("dep_7Hq2", replicas=3) ``` ## Clean up Delete deployments you no longer need with `delete_deployment()`. Your checkpoint stays in your Cell. ## Next steps - [Deploy anywhere](/docs/deploy-anywhere): Run the same deployment in your VPC or on-prem. - [Private evals and promotion](/docs/evals): Promote new checkpoints safely. --- # Deploy anywhere URL: https://rsi-labs.ai/docs/deploy-anywhere The same API and the same code run fully managed, in your VPC, or in your own data center. You own the weights, data and evals. > **Note:** Module names, regions and GPU types in examples are placeholders. ## Choose where it runs | Option | Where it runs | GPUs | Built for | | ------- | --------------------------------------------------------------------------------------------- | -------------------------------- | ------------------------------------------------- | | API | Our infrastructure, shared, fully managed and autoscaling | Ours | AI-native companies that want to move fast | | VPC | Your AWS, GCP or Azure account | Yours, on your cloud commitments | Enterprises whose data must stay in their account | | On-prem | Your own GPUs, in your data center or fully air-gapped and updated by signed offline releases | Yours | Regulated industries and the public sector | ## What each option includes The API runs on shared infrastructure. A dedicated, isolated Cell and your own encryption keys come with VPC and on-prem. | | API | VPC | On-prem and air-gapped | | --- | --- | --- | --- | | Runs on | Our infrastructure, shared and autoscaling | Your AWS, GCP or Azure account | Your GPUs, in your data center or air-gapped | | Isolation | Your data never trains anyone else's model | A dedicated Cell in your account | A dedicated Cell on your hardware | | Encryption keys | Managed by us | Yours | Yours | | Throughput and latency guarantees | With committed capacity | With committed capacity | With committed capacity | | Pricing | Per token | Platform fee on your cloud spend | Platform fee on your hardware | ## Same code everywhere Only the `endpoint` changes. Training, evals and deployments work the same in every option. ```python # Fully managed API client = rsi.Client(api_key=key) # Your VPC or data center: point at your Cell client = rsi.Client(api_key=key, endpoint="cell.acme.internal") ``` ## Set up a VPC Cell - Request a Cell from your account team. - Apply our Terraform module in your cloud account. It grants the scoped permissions the control plane needs and nothing more. - The control plane provisions GPUs, networking and storage in your account. Verify with `client.health_check()`. ```hcl title="main.tf" module "rsi_cell" { source = "rsi/cell/aws" region = "us-east-1" gpu_type = "H200" } ``` ## On-prem and air-gapped - Runs on your own GPUs, in your data center or fully air-gapped. Hardware requirements are confirmed during scoping. - Air-gapped sites are updated by signed offline releases you verify and install. ## What stays in your environment In your VPC or on-prem, prompts, training data, weights and keys stay in your Cell. The control plane only exchanges control and health signals, and never sees your data or weights. On the API, your data is never used to train anyone else's model, and you can export your weights, data and evals at any time. ## Next steps - [Deploy and serve](/docs/deploy-and-serve): Create your first deployment. - [Models and pricing](/docs/models): See models and pricing. --- # Python API URL: https://rsi-labs.ai/docs/reference/python Classes and methods for training, sampling and deploying models. For OpenAI-compatible HTTP inference, see the Inference quickstart. > **Note:** Draft reference. Method names and parameters follow the planned SDK and will be confirmed before launch. ## Client ### `Client()` ```python rsi.Client(api_key, endpoint=None, timeout=None, enable_retries=True) ``` Creates a client for the API. One client can open sessions, sample, and manage deployments. **Parameters** - `api_key` (str, required): Your API key. - `endpoint` (str, optional): Host to connect to. Defaults to the fully managed API; set it to your Cell's host for VPC or on-prem. - `timeout` (float, optional): Request timeout in seconds. - `enable_retries` (bool, optional): Retry transient errors with backoff. **Returns** `Client` ```python import os, rsi client = rsi.Client(api_key=os.environ["RSI_API_KEY"]) ``` ### `session()` ```python client.session(project=None) ``` Opens a training session with its own GPU allocation. Use it as a context manager: it keeps the session alive and releases it on exit. **Parameters** - `project` (str, optional): Groups runs and metrics in the Console. **Returns** `SessionContext` ```python with client.session(project="support") as session: ... ``` ### `chat_complete()` ```python client.chat_complete(model, messages, max_tokens=None, temperature=None) ``` Returns a chat completion from a base model. For OpenAI-compatible HTTP calls, see the Inference quickstart. **Parameters** - `model` (str, required): Model ID, for example Qwen3.8-27B. - `messages` (list[dict], required): Conversation in chat format. - `max_tokens` (int, optional): Maximum tokens to generate. - `temperature` (float, optional): Sampling temperature. **Returns** `ChatCompleteResult` ```python result = client.chat_complete( model="Qwen3.8-27B", messages=[{"role": "user", "content": "Hello!"}], ) ``` ### `create_deployment()` ```python client.create_deployment(checkpoint=None, base_model=None, unified_replicas=1, wait=False) ``` Creates a dedicated deployment from a saved checkpoint or a base model, served behind an OpenAI-compatible endpoint. **Parameters** - `checkpoint` (Checkpoint, optional): Checkpoint saved with mode="inference". Provide this or base_model. - `base_model` (str, optional): Serve a base model instead of a checkpoint. - `unified_replicas` (int, optional): Number of replicas to start with. - `wait` (bool, optional): Block until the deployment is ready. **Returns** `Deployment` ```python deployment = client.create_deployment( checkpoint=checkpoint, unified_replicas=1, wait=True, ) ``` ```json title="Response" { "id": "dep_7Hq2", "phase": "ready", "model": "dep_7Hq2", "base_url": "https://api.rsi-labs.ai/v1/deployments/dep_7Hq2", "replicas": 1 } ``` ### `get_deployment()` ```python client.get_deployment(deployment_id) ``` Fetches a deployment by ID. **Parameters** - `deployment_id` (str, required): The deployment's ID. **Returns** `Deployment` ```python deployment = client.get_deployment("dep_7Hq2") ``` ### `list_deployments()` ```python client.list_deployments() ``` Lists your deployments with their phase and replica counts. **Parameters** **Returns** `list[Deployment]` ```python for d in client.list_deployments(): print(d.id, d.phase, d.replicas) ``` ### `scale_on_target()` ```python client.scale_on_target(deployment_id, replicas) ``` Sets the desired number of replicas for a deployment. Autoscaling adjusts within the limits you set. **Parameters** - `deployment_id` (str, required): The deployment's ID. - `replicas` (int, required): Desired replica count. **Returns** `Deployment` ```python client.scale_on_target("dep_7Hq2", replicas=3) ``` ### `wait_for_deployment()` ```python client.wait_for_deployment(deployment_id, phase="ready", timeout=None) ``` Blocks until the deployment reaches the given phase, or raises if it fails. **Parameters** - `deployment_id` (str, required): The deployment's ID. - `phase` (str, optional): Phase to wait for. - `timeout` (float, optional): Seconds to wait before giving up. **Returns** `Deployment` ```python client.wait_for_deployment("dep_7Hq2") ``` ### `delete_deployment()` ```python client.delete_deployment(deployment_id) ``` Deletes a deployment. Calling it again on a deleted deployment also succeeds. **Parameters** - `deployment_id` (str, required): The deployment's ID. **Returns** `None` ```python client.delete_deployment("dep_7Hq2") ``` ### `get_deployment_usage()` ```python client.get_deployment_usage(deployment_id) ``` Replica hours and GPU hours a deployment has used so far, across every checkpoint it has served. **Parameters** - `deployment_id` (str, required): The deployment's ID. **Returns** `DeploymentUsage` ```python usage = client.get_deployment_usage("dep_7Hq2") print(usage.replica_hours) ``` ### `promote()` ```python client.promote(deployment_id, checkpoint) ``` Serves another inference-mode checkpoint of the same base model behind the same endpoint. The new checkpoint starts beside the old one and takes over once it is ready, so base_url and model do not change and requests keep working. **Parameters** - `deployment_id` (str, required): The deployment's ID. - `checkpoint` (Checkpoint | str, required): An inference-mode checkpoint, its ID or its path. **Returns** `Deployment` ```python client.promote(deployment.id, checkpoint=candidate) ``` ### `list_checkpoints()` ```python client.list_checkpoints(run_id=None, mode=None, limit=100) ``` Lists checkpoints in your project, newest first. **Parameters** - `run_id` (str, optional): Only this run's checkpoints. - `mode` (str, optional): `training` or `inference`. - `limit` (int, optional): At most this many. **Returns** `list[Checkpoint]` ```python for ckpt in client.list_checkpoints(run_id=model.training_run_id): print(ckpt.name, ckpt.step) ``` ### `get_checkpoint()` ```python client.get_checkpoint(checkpoint) ``` Gets one checkpoint by ID or path. **Parameters** - `checkpoint` (Checkpoint | str, required): ID (`ckpt_...`) or path (`rsi://...`). **Returns** `Checkpoint` ```python ckpt = client.get_checkpoint("ckpt_2pZ8") ``` ### `delete_checkpoint()` ```python client.delete_checkpoint(checkpoint) ``` Deletes a checkpoint. Immutable checkpoints cannot be deleted. **Parameters** - `checkpoint` (Checkpoint | str, required): The checkpoint, its ID or its path. **Returns** `None` ```python client.delete_checkpoint(ckpt) ``` ## Evals Private evals live under `client.evals`. See [Private evals and promotion](/docs/evals). ### `evals.create_suite()` ```python client.evals.create_suite(name, prompts, graders) ``` Creates a suite: held-out examples plus graders. Up to 500 examples and 10 graders. **Parameters** - `name` (str, required): A name for the suite. - `prompts` (list, required): Each a prompt string, a list of chat messages, or a dict with prompt or messages and an optional reference. - `graders` (list[str | Judge], required): Built-ins "exact_match", "contains", "json_valid", or rsi.Judge(name, rubric, model=None). **Returns** `EvalSuite` ```python suite = client.evals.create_suite( name="support-private-v3", prompts=[{"prompt": "Where is my order?", "reference": "tracking"}], graders=["contains", rsi.Judge("resolution", "Resolves the issue.")], ) ``` ### `evals.run()` ```python client.evals.run(candidate, baseline, suite, temperature=None, max_tokens=None, wait=True) ``` Answers every example with the candidate and the baseline, scores both with every grader and tests each difference for significance. Answers and judge calls are billed as inference tokens. **Parameters** - `candidate` (Checkpoint | Deployment | Model | str, required): What to evaluate: a checkpoint, deployment, live model, base model name, ID or rsi:// path. - `baseline` (Checkpoint | Deployment | Model | str, required): What to compare against, usually what serves production. - `suite` (EvalSuite | str, required): The suite or its ID. - `temperature` (float, optional): Decoding temperature for both sides. Default 0. - `max_tokens` (int, optional): Maximum answer length. Default 1024. - `wait` (bool, optional): Wait for the result (default). With False, returns a pending operation; call result(). **Returns** `EvalRun` ```python run = client.evals.run(candidate=checkpoint, baseline=deployment, suite=suite) if run.significant_win: client.promote(deployment.id, checkpoint=checkpoint) ``` ### `evals.get_run()` ```python client.evals.get_run(run_id, include_examples=False) ``` Returns a finished run. With include_examples, every answer and score side by side. **Parameters** - `run_id` (str, required): The run's ID. - `include_examples` (bool, optional): Include per-example answers and scores. **Returns** `EvalRun` ```python run = client.evals.get_run("evr_3Kp9", include_examples=True) for e in run.examples[:3]: print(e.candidate_answer, e.candidate_scores) ``` ### `evals.list_suites() / list_runs()` ```python client.evals.list_suites() client.evals.list_runs(suite=None) ``` Lists the project's suites, and its runs (all, or one suite's), newest first. Listed runs leave out examples. **Parameters** - `suite` (EvalSuite | str, optional): Only runs of this suite. **Returns** `list[EvalSuite] / list[EvalRun]` ```python for run in client.evals.list_runs(suite): print(run.id, run.significant_win) ``` ## Session ### `create_model()` ```python session.create_model(base_model, lora=None, checkpoint=None) ``` Creates a trainable model in the session, with a LoRA adapter or full-weight training, optionally starting from a checkpoint. **Parameters** - `base_model` (str, required): Open-weight model to start from. - `lora` (LoraConfig, optional): Train a LoRA adapter. Omit for full-weight training. - `checkpoint` (Checkpoint, optional): Resume from saved weights. **Returns** `Model` ```python model = session.create_model( base_model="Qwen3.6-35B", lora=rsi.LoraConfig(rank=16), ) ``` ### `sample()` ```python session.sample(prompts, base_model=None, checkpoint=None, num_samples=1, max_tokens=None, stop=None) ``` Samples completions from a base model or checkpoint and waits for the results. **Parameters** - `prompts` (list[str], required): Prompts to complete. - `base_model` (str, optional): Model to sample from. - `checkpoint` (Checkpoint, optional): Checkpoint to sample from. - `num_samples` (int, optional): Samples per prompt. - `max_tokens` (int, optional): Maximum tokens per sample. - `stop` (list[str], optional): Stop sequences. **Returns** `list[list[Sample]]` ```python groups = session.sample(prompts=prompts, checkpoint=ckpt, num_samples=4) ``` ## Model ### `train_step()` ```python model.train_step(batch, lr, loss_fn="cross_entropy") ``` Runs the forward pass, backward pass and an optimizer update in one call. **Parameters** - `batch` (list, required): Training examples, or RL data with advantages. - `lr` (float, required): Learning rate. - `loss_fn` (str | Loss, optional): Built-in loss such as cross_entropy or importance_sampling, or a custom loss. **Returns** `OptimStepResult` ```python model.train_step(batch, lr=1e-4, loss_fn="cross_entropy") ``` ### `forward_backward()` ```python model.forward_backward(data, loss_fn) ``` Computes the loss and gradients without updating weights. Pair with optim_step() for custom training loops. **Parameters** - `data` (list, required): Training data. - `loss_fn` (str | Loss, required): Loss to compute. **Returns** `ForwardResult` ```python model.forward_backward(data=rl_batch, loss_fn="importance_sampling") ``` ### `optim_step()` ```python model.optim_step(lr, grad_clip_norm=None, weight_decay=None) ``` Applies an Adam optimizer update using the accumulated gradients. **Parameters** - `lr` (float, required): Learning rate. - `grad_clip_norm` (float, optional): Clip gradients to this norm. - `weight_decay` (float, optional): Weight decay. **Returns** `OptimStepResult` ```python model.optim_step(lr=4e-5, grad_clip_norm=1.0) ``` ### `sample()` ```python model.sample(prompts=None, model_input=None, tools=None, num_samples=1, max_tokens=None) ``` Samples from the model's current in-memory weights, for example to generate RL rollouts. **Parameters** - `prompts` (list[str], optional): Prompts to complete. Pass prompts or model_input. - `model_input` (list[dict], optional): Chat messages instead of prompts, rendered with the base model's chat template. A list of conversations samples several at once. - `tools` (list[dict], optional): Functions the model may call, in OpenAI function format. Calls come back parsed in each Sample's tool_calls. - `num_samples` (int, optional): Samples per prompt. - `max_tokens` (int, optional): Maximum tokens per sample. **Returns** `list[list[Sample]]` ```python groups = model.sample(prompts=prompts, num_samples=4, max_tokens=4096) ``` ### `save_weights()` ```python model.save_weights(name, mode="training", immutable=False) ``` Saves the current weights as a checkpoint and returns it. A training-mode checkpoint keeps optimizer state, so a run can resume from it; an inference-mode checkpoint keeps the adapter weights only, for sampling and deployment. Names are unique within a run. **Parameters** - `name` (str, required): Checkpoint name: letters, digits, `.`, `_` or `-`. It becomes the last part of the checkpoint's path. - `mode` (str, optional): `training` (default) to resume later, or `inference` to sample or deploy. - `immutable` (bool, optional): Protect the checkpoint from deletion. **Returns** `Checkpoint` ```python checkpoint = model.save_weights("support-v1", mode="inference") print(checkpoint.path) # rsi://runs/run_.../checkpoints/support-v1 ``` ### `load_weights()` ```python model.load_weights(checkpoint, load_optimizer=True) ``` Replaces the model's weights with a checkpoint's, rewinding its step. Loading optimizer state needs a training-mode checkpoint. **Parameters** - `checkpoint` (Checkpoint | str, required): A Checkpoint, or a checkpoint ID (`ckpt_...`) or path (`rsi://...`). - `load_optimizer` (bool, optional): Also restore optimizer state (default True). **Returns** `None` ```python model.load_weights(checkpoint) ``` ### `log()` ```python model.log(metrics) ``` Records one set of scalar metrics, shown as charts in the Console. **Parameters** - `metrics` (dict[str, float], required): Metric names and values. **Returns** `None` ```python model.log({"reward/mean": 0.62, "loss": 1.84}) ``` ## RL library `from rsi.forge import rl`. See [Your first RL run](/docs/rl) for a walkthrough. | Name | What it is | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `rl.Env` | One rollout's world: `reset(row)` returns the opening messages, `on_turn(traj)` answers the model (default: runs its tool calls), `reward(traj, row)` scores the result. Also `on_error`, `on_truncated`, `close`. | | `@rl.tool` | Turns a function into a tool; the schema comes from type hints and the docstring. | | `rl.TurnResult(messages, max_turn_tokens=None)` | What `on_turn` returns to continue with a token cap for the next turn. | | `rl.Recover(result)` | What `on_error` returns to continue instead of dropping the rollout. | | `rl.InfrastructureError` | Raise it when your side fails; the run stops instead of training on the outage. | | `rl.Budget(max_turns=8, max_generated_tokens=32768, max_context_tokens=131072, segment_tokens=4096, final_answer_reserve=0, tool_output_tokens=4096, max_turn_tokens=None)` | Per-rollout limits. | | `rl.Truncation(train="zero_reward", by_cause={})` | How truncated rollouts train: `zero_reward`, `reward`, `drop` or `drop_and_exclude_from_baseline`. | | `rl.RolloutEngine(model, *, env, budget, schedule, temperature=1.0, top_p=1.0, top_k=-1, seed=None, sample_timeout=1800, environment_timeout=None)` | Runs rollouts concurrently: `submit(row, group_size=)`, `next_group()`, `rollout(rows, group_size=)`, `progress()`. | | `rl.Schedule(concurrency=256, max_sample_requests=None, admit_ahead=None, oversample_factor=1.0)` | How much sampling runs at once and how far ahead of training. | | `rl.AsyncTrainer(*, engine, optimizer, groups_per_step, group_size=16, advantage=GroupCentered(), loss="cispo", normalize=None, max_staleness=2, stale_policy="wait", truncation=Truncation(), train_zero_advantage_batches=False, sinks=(), checkpoint=None, evaluator=None, log_to_console=True)` | Trains while sampling continues; `run(dataset, steps=)` yields `rl.Step(n, model_step, metrics, trajectories)`. | | `rl.run(trainer, dataset, *, steps, on_step=None)` | Runs the trainer and returns every step. | | `rl.Adam(lr, beta1=0.9, beta2=0.95, eps=1e-8, weight_decay=0.0, grad_clip_norm=None, schedule=None)`, `rl.cosine(warmup=0, floor=0.0)` | Optimizer settings and learning-rate schedule. | | `rl.CISPO(eps_max=6.0)`, `rl.PPO(clip_low=0.2, clip_high=0.2)`, `rl.ImportanceSampling()`, `rl.DRO(beta=0.05)` | Losses; each takes `normalize` = `"token"` (default), `"sequence"` or `"sum"`. | | `rl.GroupCentered(standardize=False)`, `rl.Batchwise(standardize=False)` | Advantage estimators; any `f(rewards, *, min_members)` works too. | | `rl.Checkpointing(run_dir, *, weights_every=20, on_signal=("SIGTERM",))` | Recovery points: weights, optimizer state and run state every `weights_every` steps; rerunning the script resumes there. | | `rl.Evaluator(holdout, *, engine_factory=None, every=20, group_size=4, final_group_size=8, variants=("default",), sink=None)` | Evaluates held-out rows on saved weights in a separate session; `results` holds each `rl.Evaluation(step, variant, checkpoint, metrics, trajectories)`. | | `rl.WandbSink(run, *, table_samples=8)`, `rl.ConsoleSink(model)` | Metric sinks; the Console sink is on by default (`log_to_console=True`). | | `rl.Trajectory` | `messages`, `spans` (one per model turn, with tokens, logprobs and policy version), `reward`, `truncated`, `turns`, `final_text`, `reward_turn(value)`, `to_data(advantage)`. | ## Data types ### `LoraConfig` ```python rsi.LoraConfig(rank, train_attn=True, train_mlp=True, train_unembed=False) ``` Configures a LoRA adapter. **Parameters** - `rank` (int, required): Adapter rank. - `train_attn` (bool, optional): Train attention projections. - `train_mlp` (bool, optional): Train MLP and MoE expert layers. - `train_unembed` (bool, optional): Train the unembedding layer. ```python lora = rsi.LoraConfig(rank=16, train_unembed=True) ``` ### `Checkpoint` ```python Checkpoint ``` Saved weights. Returned by save_weights() and the checkpoint calls on Client. Anywhere a checkpoint is accepted, you can pass the Checkpoint, its `id` or its `path`. **Attributes** - `id` (str, required): The checkpoint's ID (`ckpt_...`). - `path` (str, required): `rsi://runs//checkpoints/`. - `name` (str, required): Checkpoint name, unique within the run. - `mode` (str, required): `training` or `inference`. - `step` (int, required): The training step it was saved at. - `base_model` (str, required): The base model it adapts. - `created_at` (datetime, required): When it was saved. - `expires_at` (datetime | None, required): When it expires, or None if it is kept until deleted. ```python ckpt = client.get_checkpoint("rsi://runs/run_7Hq2/checkpoints/support-v1") print(ckpt.mode, ckpt.step) ``` ### `Deployment` ```python Deployment ``` A dedicated deployment serving a checkpoint or base model. **Attributes** - `id` (str, required): Deployment ID. - `phase` (str, required): Lifecycle phase, for example ready. - `model` (str, required): Model name to pass in API calls. - `base_url` (str, required): OpenAI-compatible base URL. - `replicas` (int, required): Current replica count. ### `EvalRun` | Field | Type | | | ----------------- | ------------------------- | -------------------------------------------------------------------------------------------- | | `id` | `str` | `evr_...` | | `suite_id` | `str` | | | `significant_win` | `bool` | Better with significance on at least one grader, worse on none | | `metrics` | `dict[str, GraderResult]` | Per grader: `candidate`, `baseline` (mean scores, 0 to 1), `delta`, `p_value`, `significant` | | `alpha` | `float` | The significance level, 0.05 | | `example_count` | `int` | | | `examples` | `list[EvalExample]` | Only from `get_run(..., include_examples=True)` | ### `Sample` ```python Sample ``` One sampled completion. **Attributes** - `text` (str, required): Decoded completion. - `tokens` (list[int], required): Completion token IDs. - `logprobs` (list[float], required): Log-probabilities of the completion tokens. - `tool_calls` (list[ToolCall], optional): Tool calls the model made when tools were offered: id, name and arguments (JSON text; parsed_arguments() returns a dict). --- # Webhooks URL: https://rsi-labs.ai/docs/reference/webhooks Get notified when operations finish, checkpoints are saved, models are released or sessions expire. Long calls return an operation you can poll or wait on. Instead, RSI Labs can POST an event to your HTTPS endpoint when something happens. | Event | When | | --------------------- | ---------------------------------------------------------------- | | `operation.succeeded` | An operation finished. Carries its scalar metrics, such as loss. | | `operation.failed` | An operation failed. Carries the error. | | `checkpoint.saved` | `save_weights()` finished. Carries the checkpoint. | | `model.released` | A live model was released. | | `session.expired` | A session stopped sending heartbeats and ended. | Events carry IDs, status and metrics only, never samples, logprobs or training data. Fetch results with the operation's ID. ## Create an endpoint The secret is returned only here and when you rotate it, so store it right away. ```python endpoint = client.webhooks.create( "https://example.com/rsi-events", events=["operation.succeeded", "operation.failed", "checkpoint.saved"], ) print(endpoint.secret) # whsec_... ``` Use `"*"` to receive every event type. Endpoints must use HTTPS and resolve to a public address. ## Verify each delivery Every delivery is signed with your endpoint's secret: ```text RSI-Signature: t=1796180000,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd ``` `v1` is an HMAC-SHA256 of `.`. Verify it against the raw request body before you parse it, and reject timestamps more than five minutes old. The SDK does both: ```python import rsi def handle(request): event = rsi.webhooks.verify( request.body, request.headers["RSI-Signature"], secret=RSI_WEBHOOK_SECRET ) if event["type"] == "operation.succeeded": op_id = event["operation"]["operation_id"] return 204 ``` ## Delivery - Any `2xx` response counts as delivered. Respond quickly and do the work afterwards. - Failed deliveries are retried with exponential backoff, from 30 seconds up to 6 hours apart, for 3 days. - Delivery is at least once: deduplicate on the event's `id`, which is also sent as the `RSI-Event-Id` header. ## Rotate the secret ```python endpoint = client.webhooks.rotate_secret(endpoint.id) ``` For 24 hours after a rotation, deliveries carry two `v1` signatures, one per secret, so you can switch without missing events. ## Manage endpoints ```python client.webhooks.list() client.webhooks.update(endpoint.id, events=["*"], disabled=False) client.webhooks.delete(endpoint.id) ``` --- # MCP servers URL: https://rsi-labs.ai/docs/reference/mcp Connect coding agents and AI assistants to RSI Labs' docs and to your RSI Labs account. RSI Labs runs two remote MCP servers. Both use the Streamable HTTP transport. | Server | URL | Sign-in | What it does | | ------ | ---------------------------------- | -------------------------------- | ------------------------------------------------------------------------------- | | Docs | `https://mcp.rsi-labs.ai/docs/mcp` | None | Searches and reads these docs, so agents write RSI Labs code from current pages | | API | `https://mcp.rsi-labs.ai/mcp` | OAuth with your RSI Labs account | Acts as you: runs, metrics, usage, chat and API keys | ## Add the docs server Point your client at the docs URL. In Claude Code: ```bash claude mcp add --transport http rsi-docs https://mcp.rsi-labs.ai/docs/mcp ``` Clients that take a JSON config use the same URL: ```json title="mcp.json" { "mcpServers": { "rsi-docs": { "type": "http", "url": "https://mcp.rsi-labs.ai/docs/mcp" } } } ``` Tools: `search_docs` (best-matching sections with links), `read_doc` (a whole page as Markdown) and `list_docs` (every page). ## Add the API server Add the API URL the same way. The first time a tool runs, your client opens a browser to sign in to RSI Labs and asks you to allow access and choose a team. ```bash claude mcp add --transport http rsi https://mcp.rsi-labs.ai/mcp ``` Every tool acts as you, with your role in that team, and works in the team's first project unless you pass `project_id`. | Tool | What it does | Role | | ---------------------------------- | --------------------------------------------------------------- | ---------------- | | `whoami` | Your user, team, role and projects | Any | | `get_capabilities` | Base models you can post-train or chat with | Any | | `list_runs`, `get_run` | Training runs and their status and step | Any | | `get_run_metrics` | Loss, grad norm, learning rate and the metrics your script logs | Any | | `get_usage` | Tokens by day, base model and API key | Any | | `chat` | Chat with a base model or a run that is training now (metered) | Developer and up | | `list_api_keys` | API keys in a project | Any | | `create_api_key`, `revoke_api_key` | Manage API keys | Owner or Admin | Training loops are not tools: write them with the Python SDK, as in [Your first SFT run](/docs/sft). ## What gets recorded Every API tool call appears in your team's audit log in the Console, with who made it and the OAuth client that sent it. The log records IDs and counts, never prompts or outputs. Prompts in `chat` go to your Cell only. To disconnect, remove the server from your client's MCP settings.