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.
How it works
You ask. Your agent adds it. With one install and one key.
- 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.
- 02
Ask for GPUs in code, and it installs the SDK.
npm install @runcrate/sdkorpip install runcrate-sdk. Your key goes inRUNCRATE_API_KEY, which both SDKs and the CLI read. - 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.
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
Connect your agent first
Add Runcrate's MCP server to yourself: run curl -fsSL "https://runcrate.ai/mcp.md" and follow it.
npm install @runcrate/sdkimport 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);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.
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.
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 key
apiKey - Default: from env
- Read from
RUNCRATE_API_KEYwhen you leave it out, so it never lands in your code. - One environment at a time
environment - 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 call
timeout - Default: 30
- In seconds. Images, video and speech set their own 120.
- How often to retry
maxRetries - 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.
Runcrate's SDKs for TypeScript and Python: start, check and terminate a GPU from your own code.
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.
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