Skip to main content

JarvisLabs Client (Deprecated)

Deprecated — Use the new Python SDK

jlclient is deprecated and no longer maintained. We've built a completely new Python SDK (jarvislabs) with a modern API, a full-featured CLI (jl), and built-in support for AI coding agents like Claude Code, Codex, Cursor, and OpenCode.

Switch now:

uv tool install jarvislabs
jl setup

See the new Python SDK docs and CLI docs for the complete reference.

Is a Python API for Interacting with Jarvislabs.ai for creating GPU/CPU-powered instances.

Steps to get started

  1. Install JLclient
  2. Generate API token
  3. Authentication
  4. Create an Instance object which will let you -
    • Launch GPU/CPU powered instance
    • Pause the instance
    • Resume
    • Destroy
  5. Use the User class to
    • get instances that are in running and paused state.
  6. Use FileSystem class to manage FileSystem lifecycle.
    • Attach a FileSystem to an instance during creation.
    • Attach a FileSystem to an instance during resume.

Installation

pip install git+https://github.com/jarvislabsai/jlclient.git

Generate API token

you can Generate API token from Jarvislabs.ai.

Imports and configure

from jlclient import jarvisclient
from jlclient.jarvisclient import *
jarvisclient.token = '**************************duWRbO68IiMTkQKWi48'

Managing GPU/CPU powered instances on Jarvislabs.ai

Create Instance

Attributes

ParameterTypeDescription/ValuesDefault Value
instance_typestrChoose between GPU or CPU.GPU
num_gpus / num_cpusintAccording to the instance_type, choose the number of GPUs or CPUs.1
gpu_typestrChoose from A30, L4, A100, A100-80GB, H100, H200, RTX-PRO6000.
templatestrUse User.get_templates() in our JLclient to get all templates.pytorch
script_idstrIf you have a script you can pass it.None
is_reservedboolTrue refers to an on-demand instance. False refers to a spot instance. The new SDK/API uses is_spot (with reversed polarity) instead — see Pricing & Savings for details.True
durationstrChoose hour, week, and month. The pricing changes based on the duration..hour
http_portsstrAs per your requirement, you can specify the ports.None
storageintChoose between 20GB to 2TB.20

GPU availability varies by region and workload type. Run jl gpus to see current availability and pricing.

# Launch CPU Instance
instance: Instance = Instance.create('CPU',
num_cpus=1,
storage=25,
name='cpu instance')

# Launch GPU Instance
instance: Instance = Instance.create('GPU',
gpu_type='RTX-PRO6000',
num_gpus=1,
storage=50,
name='gpu instance')


This should return the Instance object.

you can access the below attributes using the Instance object.

  • gpu_type
  • num_gpus
  • num_cpus
  • storage
  • name
  • machine_id
  • script_id
  • is_reserved
  • duration
  • script_args
  • http_ports
  • template
  • url
  • endpoints
  • ssh_str
  • status

Pause the instance

instance.pause()

You can call pause() on any Instance object.

Resume the instance

#Resuming with existing configuration
instance.resume()

#Modifying the parameters like scaling GPUs, switching GPU type, expanding storage, etc.
instance.resume(num_gpus=1,
gpu_type='RTX-PRO6000',
storage=100)

#Switching from GPU to CPU Instance
instance.resume(num_cpus=1,
storage=25)

#Switching from CPU to GPU Instance
instance.resume(gpu_type='RTX-PRO6000',
num_gpus=1,
storage=25)

You can modify an existing instance by changing the below resume parameters.

  • num_gpus

  • gpu_type

  • storage

or just call resume without any parameters to start the instance with the same configuration.

Destroy the instance

instance.destroy()

Pausing inside a Jarvislabs instance

You can use the below function to pause an instance

import os
from jlclient import jarvisclient
from jlclient.jarvisclient import *
jarvisclient.token = "*****"

def pause():
machine_id = os.getenv('MACHINE_ID')
instance = User.get_instance(machine_id)
instance.pause()

User management

The User class comes with the below key functionalities.

  • User.get_templates(): Returns the list of templates available.

  • User.get_instances(): Returns a list of Instance objects representing all the instances in your account.

  • User.get_balance(): Return the balance of the user.

FileSystem

You can use the FileSystem class to create, delete and list all the filesystems in your account.

fs = FileSystem()
fs.list() # List all the filesystems in your account.
fs.create(fs_name='test', storage=500) # Create a new filesystem with the given name and size, returns fs_id that can be used to attach fs to an instance.
fs.delete(fs_id=333) # Delete the filesystem with the given name.

Attach FileSystem to an instance during creation

instance: Instance = Instance.create('GPU',
gpu_type='RTX-PRO6000',
num_gpus=1,
storage=50,
name='gpu instance',
fs_id='332'
)

Attach FileSystem to an instance during resume

instance.resume(fs_id='333')
note

You can get the fs_id by calling fs.list()

Issues/Feature request

Do you like to see any new features, we are all ears. You can drop us an email at support@jarvislabs.ai or chat with us for requesting any new features or reporting issues.

License

This project is licensed under the terms of the MIT license.