Skip to content

SDK

Runcrate in your app. TypeScript or Python.

Ask Claude Code or Codex to add Runcrate to your app. It installs the SDK and writes the calls: models and GPUs from $0.22/hr, on one key.

@runcrate/sdk on npm, runcrate-sdk on PyPI.

The request: import Runcrate from "@runcrate/sdk"; const rc = new Runcrate(); // reads RUNCRATE_API_KEY const stream = await rc.models.chatCompletion({ model: "deepseek-ai/DeepSeek-V4.1-Flash", messages: [{ role: "user", content: "In two sentences: why do GPUs train neural networks faster than CPUs?" }], max_tokens: 160, stream: true, stream_options: { include_usage: true }, }); for await (const chunk of stream) { const choices = chunk.choices as { delta: { content?: string } }[]; process.stdout.write(choices[0]?.delta.content ?? ""); }
Response
200TTFT 1.5 s2.0 s

Captured from a real call to api.runcrate.ai on November 14, 2026.

How it works

You ask. Your agent adds it. With one install and one key.

  1. 01

    Hand it the lines.

    The model line has your agent wire a Runcrate model into your project with the OpenAI SDK. The MCP line lets it start GPUs for you. Use either, or both.

  2. 02

    Ask for GPUs in code, and it installs the SDK.

    npm install @runcrate/sdk or pip install runcrate-sdk. Your key goes in RUNCRATE_API_KEY, which both SDKs and the CLI read.

  3. 03

    It writes the calls and runs them.

    You review the change like any other. The code stays in your repo and runs on your own servers.

Get started in the docs

Hand this to your agent

Add a Runcrate model to this project: run curl -fsSL "https://runcrate.ai/agents.md?intent=build" and follow it.

Your agent asks for an API key. Create a key

Works inClaude CodeCodexOpenCodeClineRoo CodeKilo CodeCursor

Connect your agent first

Add Runcrate's MCP server to yourself: run curl -fsSL "https://runcrate.ai/mcp.md" and follow it.

Add to CursorInstall in VS Code
Works inClaude CodeCodexOpenCodeClineRoo CodeKilo CodeCursor

npm install @runcrate/sdk

@runcrate/sdk · Node.js 18 or newer · no dependencies · MIT

first-call.mtsts
import Runcrate from "@runcrate/sdk";
const rc = new Runcrate(); // reads RUNCRATE_API_KEY
const reply = await rc.models.chatCompletion({
model: "deepseek-ai/DeepSeek-V4.1-Flash",
messages: [{ role: "user", content: "In two sentences: why do GPUs train neural networks faster than CPUs?" }],
});
console.log(reply.choices[0].message.content);
What came back

GPUs have thousands of simple cores that perform the matrix and vector operations underlying neural network training in massive parallel, while CPUs have fewer, more complex cores optimized for sequential and general-purpose tasks. This parallelism lets GPUs process many training examples and parameters simultaneously, greatly increasing throughput compared with CPUs.

deepseek-ai/DeepSeek-V4.1-Flash's answer to this prompt, captured on November 14, 2026.

What it covers

Models and GPUs. In both languages.

  • rc.models

    Chat, images, video, speech and transcription, on every model in the catalog.

    9 methods

  • rc.chat.completions

    The same chat call in the OpenAI SDK's shape, for code that already speaks it.

    1 method

  • rc.instances

    See every GPU on offer with its price, launch one, check its status, terminate it.

    6 methods

  • rc.storage

    Volumes that outlive an instance: create, resize and delete them, and list regions.

    6 methods

  • rc.templates

    The crates an instance can boot, with what each has installed.

    1 method

  • rc.sshKeys

    Public keys an instance accepts, for tools that connect over SSH.

    3 methods

  • rc.environments

    Keep staging apart from production inside one workspace.

    5 methods

  • rc.billing

    Your balance, every transaction and what you spent, as numbers.

    3 methods

Python has the same namespaces in snake case: client.models.chat_completion, client.instances.get_status.

Every method in the docs

Why the SDK

Less for your agent to get wrong. Than calling the API by hand.

  • retries

    GPU, storage and billing calls retry a 429, 500, 502, 503 or 504 with backoff, as do TypeScript model calls that are not streamed. A bad request fails at once.

    up to 3 times

  • RateLimitError

    Every error the API returns is a class with its status code and message, so code catches the one it handles.

    9 classes, by status

  • stream: true

    A streamed chat is an async iterator in TypeScript and an iterator in Python. No events to parse by hand.

    for await … of stream

  • types

    Full TypeScript types, Pydantic models in Python. TypeScript hands responses back in camelCase.

    reply.choices[0].message

Change only what you need.

Every option has a default. Python takes the same ones in snake case: max_retries, api_key.

Your keyapiKey
Default: from env
Read from RUNCRATE_API_KEY when you leave it out, so it never lands in your code.
One environment at a timeenvironment
Default: default
A client pointed at staging only sees staging's instances and volumes. Keys, billing and templates stay workspace-wide.
A time limit on each calltimeout
Default: 30
In seconds. Images, video and speech set their own 120.
How often to retrymaxRetries
Default: 3
Retries a 429, 500, 502, 503 or 504 only. 0 turns them off. Python model calls and streamed chats never retry.

Examples

Ask once. Your agent writes the code.

Claude Code or Codex installs the SDK, writes the call and runs it. The code it writes is the docs' own.

Docs

Runcrate's SDKs for TypeScript and Python: start, check and terminate a GPU from your own code.

Write launch.mts with the Runcrate SDK: start an A100 with my SSH key, print its status, then terminate it. Runs npm install @runcrate/sdk. It returns: the TypeScript SDK, installed. Writes launch.mts: the instance calls from the SDK docs, with your key from rc.sshKeys.list(). Runs npx tsx launch.mts. It returns: the status (still provisioning), then the instance terminated.

Pricing

Same prices. Whatever sends the call.

  • A call costs the same from the SDK, your agent, the CLI or plain HTTP. One balance pays for all of it.

  • Models bill for what they produce: tokens, images or seconds, at the price shown. GPUs bill for the time they run.

See every price

Model or GPU

As billed

  • DeepSeek V4.1 Flash

    DeepSeek

    $0.147 in, per 1M tokens

    $0.441 out

  • Qwen3.8 27B

    Alibaba

    $0.158 in, per 1M tokens

    $1.97 out

  • gpt-oss 20B

    OpenAI

    $0.0315 in, per 1M tokens

    $0.147 out

  • H100

    GPU, 80GB, cheapest offer

    $3.97/hr

  • A100 80GB

    GPU, 80GB, cheapest offer

    $1.73/hr

  • RTX 4090

    GPU, 24GB, cheapest offer

    $0.58/hr

FAQ

Questions about the SDKs.