Skip to main content

fcloud

Python SDK and CLI for the fcloud GPU compute platform: provision GPU or CPU hosts, run commands and scripts on them, keep a persistent workspace between runs, move files in and out, and drive long-running or batch jobs — from a terminal, from Python, or from an AI coding agent.

Requires Python 3.10+.

Install

pip install fcloud-sdk

Or from a checkout of this repository:

cd packages/fcloud-sdk
pip install -e .          # editable: `git pull` picks up SDK updates

Setup

You need a fcloud API key. Save it once (it is written to ~/.fcloud/token with mode 0600 and never printed):

fcloud setup            # prompts for the key; optionally installs the agent skill
fcloud health           # verify connectivity

fcloud setup --agents all also installs the fcloud skill file for supported coding agents (Cursor, Claude Code, Codex) so an agent can drive fcloud for you. Use --agents none to skip that.

Quick start

# Run a one-off command on a GPU
fcloud exec --sku gpu_1x_l4 nvidia-smi -L

# Upload a script and run it
fcloud run train.py --sku gpu_1x_l4

# Upload a project directory, run one script in it, pass arguments through
fcloud run . --script train.py --sku gpu_1x_l4 -- --epochs 50

# See what hardware is available
fcloud skus

fcloud run <dir> uploads the whole directory. Keep secrets, virtualenvs and large data out of the tree you point it at.

How the pieces fit

  • session — a persistent /workspace filesystem, not a held GPU. It costs nothing until used; exec/run/shell/upload bring it online with its files intact, and fcloud stop halts spend but keeps the files. Address an existing one with --on <SID>.
  • volume — a named folder you mount into a session with --volume; this is how data moves between sessions. Writes commit back as a new version when the session detaches or closes.
  • process — work running inside a session. exec/run wait in the foreground; spawn returns a process id you then wait/logs/kill.
  • job — a run-to-completion session with no saved filesystem; its durable outputs are its volumes and its logs.
  • sweepfcloud map fans one command out over many argument bindings as a durable batch you inspect with fcloud sweep.

CLI

fcloud help prints the full grouped list; fcloud help <command> prints details.

Find hardware
  fcloud skus                                          List SKUs and prices
  fcloud health                                        Check API connectivity

Run code
  fcloud exec [--sku SKU] [--on SID] <cmd...>          Run a command on a host
  fcloud run <file|dir> [--sku SKU] [--on SID]         Upload and run a script
  fcloud shell [--sku SKU] [--on SID] [--volume NAME]  Interactive shell
  fcloud ssh <SID>                                     SSH into a session
  fcloud tunnel <SID> [--port PORT]                    SSH ProxyCommand tunnel

Background processes (inside a session)
  fcloud spawn --on SID <cmd...>                       Start a background process
  fcloud wait <SID> <PID> [--timeout DUR]              Wait for it; exit with its code
  fcloud logs <SID> [PID] [--follow]                   Show process output
  fcloud kill <SID> <PID>                              Kill it

Sessions (the persistent filesystem)
  fcloud create [--sku SKU] [--min-disk-gb N]          Create a session ($0 until used)
  fcloud sessions [SID] [--all] [--limit N]            List sessions
  fcloud history <SID> [--limit N]                     Session event history
  fcloud stop <SID>                                    Stop now (files kept)

Files
  fcloud upload [--on SID] <local> [remote]            Upload files
  fcloud download [--on SID] <remote> [local]          Download a file
  fcloud ls <SID> [path]                               List a session's files
  fcloud mount <SID> <mountpoint>                      Mount session files read-only (needs rclone)

Volumes (data that outlives a session)
  fcloud volume <create|list|files|download|cat|import|delete> ...

Batch
  fcloud job <run|ls|logs|wait|kill> ...               Run-to-completion jobs
  fcloud map [--sku SKU] -- <cmd {}> ::: v1,v2...      Fan a command out over bindings
  fcloud sweeps / fcloud sweep <status|logs|retry|cancel|wait> <name>

Setup
  fcloud setup [--token KEY] [--agents all|cursor|claude|codex|none]
  fcloud set_token <api-key>
  fcloud --version

All commands accept --json for machine-readable output.

fcloud exec returns bounded stdout by default. If --json reports stdout_truncated: true, fetch the full log instead of rerunning:

fcloud logs <session-id> <process-id> --output all
fcloud logs <session-id> <process-id> --stream stderr --output all

Python SDK

import fcloud

client = fcloud.Client()

image = fcloud.Image.debian_slim().pip_install(["torch", "numpy"])
project = client.project("my-run", image=image)

with project.session(sku="gpu_1x_l4") as s:
    s.upload("./data", "data/")
    result = s.run(["python3", "/workspace/data/train.py"])
    print(result.stdout)
    if result.stdout_truncated:
        print(s.logs(result.process_id, output_range="all").output)
    weights = s.download("model.pt")

Errors raise fcloud.FcloudError (or a subclass such as PaymentOverdueError).

Configuration

API key, in order of precedence:

  1. api_key= passed to Client()
  2. FCLOUD_API_KEY exported in the shell
  3. Saved token in ~/.fcloud/token (from fcloud setup / fcloud set_token)
  4. FCLOUD_API_KEY in the nearest .env file (searched upward from the cwd)

API URL, in order of precedence:

  1. url= passed to Client()
  2. FCLOUD_URL exported in the shell
  3. Saved URL in ~/.fcloud/url
  4. FCLOUD_URL in the nearest .env — only honoured when that same .env is also supplying the API key, so a checked-out repo can't redirect a saved token elsewhere
  5. https://fcloud-dispatcher.fly.dev

Other environment switches:

Variable Effect
FCLOUD_QUIET=1 Suppress "still waiting" progress lines while a host is provisioned
FCLOUD_QUEUE_TIMEOUT=<seconds> How long to wait for capacity before giving up (default 1200)
FCLOUD_MIGRATE_RESTART=never Don't automatically re-run a command after a host rebuild (default auto)
FCLOUD_INSECURE_HTTP=1 Allow a plaintext http:// API URL to a non-loopback host (refused by default — the API key would travel unencrypted). Loopback URLs never need this
FCLOUD_TELEMETRY=0 Disable all client telemetry. When enabled (the default), the client reports failures the backend cannot otherwise see — an uncaught CLI error, a queue-wait timeout, exhausted connect retries — as a fixed-allowlist payload (session id, event type, error class, truncated message, SKU/timing fields); never file contents, paths from OS errors, or credentials

A fcloud.json at the project root can set defaults (image build steps, default volumes). Note that fcloud will run the build steps it finds there, so treat a cloned repo's fcloud.json the way you would its Dockerfile.

Agent skill

fcloud setup --agents all installs SKILL.md for supported coding agents. It is the long-form, agent-oriented guide: workflow patterns, monitoring loops, and anti-patterns.

Development

pip install -e ".[dev]"
pytest
ruff check src tests

License

Apache License 2.0 — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fcloud_sdk-0.1.0.tar.gz (314.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fcloud_sdk-0.1.0-py3-none-any.whl (232.5 kB view details)

Uploaded Python 3

File details

Details for the file fcloud_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: fcloud_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 314.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fcloud_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c9ba0d0b9a5e4c506e47c9c87e6b992d5d37271ed5508554aa54f091f97e4b6f
MD5 e73585042610a01ce93392e28e06e82e
BLAKE2b-256 78a0a84ecdcaf6133bf0b653bdad93abd7be5d319a410dffa4831e9a5c09d519

See more details on using hashes here.

File details

Details for the file fcloud_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fcloud_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 232.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fcloud_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d81612f1a72e27abb422108efed102e15fa78b801d0d9695b2e3453ad8d66d90
MD5 ad3a62fe2760020aad7100ad5f922c57
BLAKE2b-256 f5b07d6f8b4023dca63a25646474616b51adfd8463ea66b7c1eded97f0bba602

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page