Skip to main content

Python wrapper of the ovh python api for managing OVH GPU instances

Project description

ovhmanager

Python wrapper of the ovh python api for managing OVH GPU instances

The wrapper uses:

The implementation idea came from the need to easily spin-up an OVH cloud GPU instance, then delete it when no longer needed (avoiding unecessary costs billing)

PyPI Python License docs

Developer Guide

If you are new to using nbdev here are some useful pointers to get you started.

Install ovhmanager in Development mode

# make sure ovhmanager package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to ovhmanager
$ nbdev_prepare

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/hassoun/ovhmanager.git

or from conda

$ conda install -c hassoun ovhmanager

or from pypi

$ pip install ovhmanager

Documentation

Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

Prerequisite

1. OVH Cloud account

You will need to have an OVH Cloud account and at least one associated Project created

2. OVH Cloud API token

Also in order to be able to use the OVH API you will need to create an API token on ovhcloud

3. SSH Key

You will need to add SSH keys of the machines that will be used to SSH into the GPU instances. These plublic SSH keys need to be added to each OVH Project (can be done from the OVH Clound UI)

4. Environment Variables

Thi will generate keys and secrets, that you will need to make available as environment variables:

  • OVH_ENDPOINT: ‘ovh-eu’ for example
  • OVH_APPLICATION_KEY: generated from API token creation
  • OVH_APPLICATION_SECRET: generated from API token creation
  • OVH_CONSUMER_KEY: generated from API token creation

How to use

Let’s try to go end to end by: 1. initializing the OVHGPUManager 2. selecting an OVH cloud project 3. creating a GPU instance 4. stopping the GPU instance 5. strating the GPU instance 6. deleting the GPU instance

gpumgr = OVHGPUManager()
gpumgr.select_project(PROJECT_ID)
gpumgr.create_instance()
2026-02-11 17:28:46.915 | INFO     | ovhmanager.core:select_region:120 - Available region:

1. BHS
2. BHS5
3. CA-EAST-TOR
4. DE
5. DE1
6. EU-SOUTH-MIL
7. EU-WEST-PAR
8. GRA
9. GRA9
10. RBX
11. RBX-A
12. RBX-ARCHIVE
13. SBG
14. SBG5
15. UK
16. UK1
17. WAW
18. WAW1

Select region number:  9

2026-02-11 17:28:50.603 | INFO     | ovhmanager.core:select_region:129 - Selected region: GRA9
2026-02-11 17:28:51.532 | INFO     | ovhmanager.core:retrieve_catalog_dict:166 - Retrieved catalog dictionary for FR subsidiary
2026-02-11 17:28:51.532 | INFO     | ovhmanager.core:select_gpu_instance_type:195 - Retrieved OVH catalog
2026-02-11 17:28:51.532 | INFO     | ovhmanager.core:select_consumption_mode:144 - Available consumption modes:


Consumption modes:
1. consumption (hourly)
2. monthly.postpaid

Select mode:  1

2026-02-11 17:28:54.716 | INFO     | ovhmanager.core:select_consumption_mode:151 - Selected consumption mode: consumption
2026-02-11 17:28:54.724 | INFO     | ovhmanager.catalog:list_gpu_instances:101 - Available GPU instances:

+----+------------+------------------+----------------+--------------+-------------+--------+
|    | Name       | Price per hour   | GPU Model      | GPU Memory   |   CPU Cores | RAM    |
+====+============+==================+================+==============+=============+========+
|  1 | a10-180    | 3.04 €           | A10            | 24GB         |         120 | 180GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  2 | a10-45     | 0.76 €           | A10            | 24GB         |          30 | 45GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  3 | a10-90     | 1.52 €           | A10            | 24GB         |          60 | 90GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  4 | h100-1520  | 11.20 €          | H100           | 80GB         |         120 | 1520GB |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  5 | h100-380   | 2.80 €           | H100           | 80GB         |          30 | 380GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  6 | h100-760   | 5.60 €           | H100           | 80GB         |          60 | 760GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  7 | l4-180     | 1.50 €           | L4             | 24GB         |          45 | 180GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  8 | l4-360     | 3.00 €           | L4             | 24GB         |          90 | 360GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
|  9 | l4-90      | 0.75 €           | L4             | 24GB         |          22 | 90GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 10 | rtx5000-28 | 0.36 €           | Quadro-RTX5000 | 16GB         |           4 | 28GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 11 | rtx5000-56 | 0.72 €           | Quadro-RTX5000 | 16GB         |           8 | 56GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 12 | rtx5000-84 | 1.08 €           | Quadro-RTX5000 | 16GB         |          16 | 84GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 13 | t1-180     | 6.60 €           | Tesla V100     | 16GB         |          36 | 180GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 14 | t1-45      | 1.65 €           | Tesla V100     | 16GB         |           8 | 45GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 15 | t1-90      | 3.30 €           | Tesla V100     | 16GB         |          18 | 90GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 16 | t1-le-180  | 2.80 €           | Tesla V100     | 16GB         |          32 | 180GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 17 | t1-le-45   | 0.70 €           | Tesla V100     | 16GB         |           8 | 45GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 18 | t1-le-90   | 1.40 €           | Tesla V100     | 16GB         |          16 | 90GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 19 | t2-180     | 7.20 €           | Tesla V100S    | 32GB         |          60 | 180GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 20 | t2-45      | 1.80 €           | Tesla V100S    | 32GB         |          15 | 45GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 21 | t2-90      | 3.60 €           | Tesla V100S    | 32GB         |          30 | 90GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 22 | t2-le-180  | 3.20 €           | Tesla V100S    | 32GB         |          60 | 180GB  |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 23 | t2-le-45   | 0.80 €           | Tesla V100S    | 32GB         |          15 | 45GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+
| 24 | t2-le-90   | 1.60 €           | Tesla V100S    | 32GB         |          30 | 90GB   |
+----+------------+------------------+----------------+--------------+-------------+--------+


Select GPU instance number:  10

2026-02-11 17:28:59.896 | INFO     | ovhmanager.core:select_gpu_instance_type:209 - Selected GPU: rtx5000-28, with consumption consumption mode
2026-02-11 17:28:59.968 | INFO     | ovhmanager.core:retrieve_gpu_flavor:226 - Selected GPU flavor id: c5708c95-f450-43c3-8b56-7d498e7b5d07
2026-02-11 17:29:00.883 | INFO     | ovhmanager.core:select_instance_image:247 - 
Available Ubuntu images:

1. Baremetal - Ubuntu 22.04
2. Ubuntu 25.04
3. Ubuntu 24.04
4. Ubuntu 22.04
5. Ubuntu 25.04 - UEFI
6. Ubuntu 24.04 - UEFI
7. Ubuntu 22.04 - UEFI

Select image number:  3

2026-02-11 17:29:05.719 | INFO     | ovhmanager.core:select_instance_image:256 - Selected instance image: 8d595649-b9b2-4aeb-a544-a3709abf437f:Ubuntu 24.04
2026-02-11 17:29:05.784 | INFO     | ovhmanager.core:select_ssh_key:274 - 
Available SSH keys:

1. Mac-V
2. Sys76

Select SSH key number:  1

2026-02-11 17:29:10.665 | INFO     | ovhmanager.core:select_ssh_key:282 - Selected SSH key: 5457466a4c56593d:Mac-V


Enter instance name:  test-auto-7

2026-02-11 17:29:21.730 | INFO     | ovhmanager.core:create_instance:323 - 
Creating instance 'test-auto-7'...

(<ovhmanager.instance.GPUInstance>,
 {'id': 'f98f4cda-09a4-4598-8d19-0e77429b2272',
  'name': 'test-auto-7',
  'ipAddresses': [],
  'status': 'BUILD',
  'created': '2026-02-11T16:29:25Z',
  'region': 'GRA9',
  'flavor': {'id': 'c5708c95-f450-43c3-8b56-7d498e7b5d07',
   'name': 'rtx5000-28',
   'region': 'GRA9',
   'ram': 28,
   'disk': 400,
   'vcpus': 4,
   'type': 'ovh.raid-nvme.t1',
   'osType': 'linux',
   'inboundBandwidth': 2000,
   'outboundBandwidth': 2000,
   'available': True,
   'planCodes': {'monthly': None,
    'hourly': 'rtx5000-28.consumption',
    'license': None},
   'capabilities': [{'name': 'resize', 'enabled': True},
    {'name': 'snapshot', 'enabled': True},
    {'name': 'volume', 'enabled': True},
    {'name': 'failoverip', 'enabled': True}],
   'quota': 7},
  'image': {'id': '8d595649-b9b2-4aeb-a544-a3709abf437f',
   'name': 'Ubuntu 24.04',
   'region': 'GRA9',
   'visibility': 'public',
   'type': 'linux',
   'minDisk': 0,
   'minRam': 0,
   'size': 4,
   'creationDate': '2025-11-05T10:08:13Z',
   'status': 'active',
   'user': 'ubuntu',
   'flavorType': None,
   'tags': [],
   'planCode': None},
  'sshKey': {'id': '5457466a4c56593d',
   'name': 'Mac-V',
   'regions': ['GRA9'],
   'fingerPrint': 'db:d2:44:36:a8:5a:61:e4:fd:3f:8c:d1:f3:7b:db:89',
   'publicKey': 'ssh-ed25519 SSH_KEY_VALUE YOUR_EMAIL_ADDRESS'},
  'monthlyBilling': None,
  'planCode': 'rtx5000-28.consumption',
  'licensePlanCode': None,
  'operationIds': [],
  'currentMonthOutgoingTraffic': None,
  'rescuePassword': None,
  'availabilityZone': None})
gpumgr.last_gpu_instance.display_details()
client: <ovh.client.Client object>
project_base_url: /cloud/project/PROJECT_ID
region: GRA9
name: test-auto-7
id: f98f4cda-09a4-4598-8d19-0e77429b2272
status: BUILD
gpu_type: rtx5000-28
flavor_id: c5708c95-f450-43c3-8b56-7d498e7b5d07
image_id: 8d595649-b9b2-4aeb-a544-a3709abf437f
consumption_mode: consumption
planCode: rtx5000-28.consumption
created: 2026-02-11T16:29:25Z
gpumgr.list_instances()
2026-02-11 17:32:00.040 | INFO     | ovhmanager.core:list_instances:356 - 
Available GPU instances:

client: <ovh.client.Client object>
project_base_url: /cloud/project/PROJECT_ID
region: GRA9
name: test-auto-7
id: f98f4cda-09a4-4598-8d19-0e77429b2272
status: ACTIVE
gpu_type: rtx5000-28
flavor_id: c5708c95-f450-43c3-8b56-7d498e7b5d07
image_id: 8d595649-b9b2-4aeb-a544-a3709abf437f
consumption_mode: consumption
planCode: rtx5000-28.consumption
created: 2026-02-11T16:29:25Z
------

[<ovhmanager.instance.GPUInstance>]
gpuinst = gpumgr.gpu_instances[0]
gpuinst.stop()
2026-02-11 17:32:34.030 | INFO     | ovhmanager.instance:stop:105 - 
 Stopping instance
2026-02-11 17:32:34.307 | INFO     | ovhmanager.instance:stop:108 - 
 GPU Instance: f98f4cda-09a4-4598-8d19-0e77429b2272 is being stopped
gpumgr.list_instances()
2026-02-11 17:32:55.581 | INFO     | ovhmanager.core:list_instances:356 - 
Available GPU instances:

client: <ovh.client.Client object>
project_base_url: /cloud/project/PROJECT_ID
region: GRA9
name: test-auto-7
id: f98f4cda-09a4-4598-8d19-0e77429b2272
status: SHUTOFF
gpu_type: rtx5000-28
flavor_id: c5708c95-f450-43c3-8b56-7d498e7b5d07
image_id: 8d595649-b9b2-4aeb-a544-a3709abf437f
consumption_mode: consumption
planCode: rtx5000-28.consumption
created: 2026-02-11T16:29:25Z
------

[<ovhmanager.instance.GPUInstance>]
gpuinst.start()
2026-02-11 17:33:23.592 | INFO     | ovhmanager.instance:start:88 - 
 Starting instance
2026-02-11 17:33:23.968 | INFO     | ovhmanager.instance:start:91 - 
 GPU Instance: f98f4cda-09a4-4598-8d19-0e77429b2272 is being started
gpumgr.list_instances()
2026-02-11 17:33:53.214 | INFO     | ovhmanager.core:list_instances:356 - 
Available GPU instances:

client: <ovh.client.Client object>
project_base_url: /cloud/project/PROJECT_ID
region: GRA9
name: test-auto-7
id: f98f4cda-09a4-4598-8d19-0e77429b2272
status: ACTIVE
gpu_type: rtx5000-28
flavor_id: c5708c95-f450-43c3-8b56-7d498e7b5d07
image_id: 8d595649-b9b2-4aeb-a544-a3709abf437f
consumption_mode: consumption
planCode: rtx5000-28.consumption
created: 2026-02-11T16:29:25Z
------

[<ovhmanager.instance.GPUInstance>]
gpuinst.display_details()
client: <ovh.client.Client object>
project_base_url: /cloud/project/PROJECT_ID
region: GRA9
name: test-auto-7
id: f98f4cda-09a4-4598-8d19-0e77429b2272
status: ACTIVE
gpu_type: rtx5000-28
flavor_id: c5708c95-f450-43c3-8b56-7d498e7b5d07
image_id: 8d595649-b9b2-4aeb-a544-a3709abf437f
consumption_mode: consumption
planCode: rtx5000-28.consumption
created: 2026-02-11T16:29:25Z
gpuinst.delete()
2026-02-11 17:35:15.415 | INFO     | ovhmanager.instance:delete:71 - 
 Deleting instance
2026-02-11 17:35:15.721 | INFO     | ovhmanager.instance:delete:74 - 
 GPU Instance: f98f4cda-09a4-4598-8d19-0e77429b2272 is being deleted
gpumgr.get_instance(gpuinst.id)
client: <ovh.client.Client object>
project_base_url: /cloud/project/PROJECT_ID
region: GRA9
name: test-auto-7
id: f98f4cda-09a4-4598-8d19-0e77429b2272
status: DELETING
gpu_type: rtx5000-28
flavor_id: c5708c95-f450-43c3-8b56-7d498e7b5d07
image_id: 8d595649-b9b2-4aeb-a544-a3709abf437f
consumption_mode: consumption
planCode: rtx5000-28.consumption
created: 2026-02-11T16:29:25Z

(<ovhmanager.instance.GPUInstance>,
 {'id': 'f98f4cda-09a4-4598-8d19-0e77429b2272',
  'name': 'test-auto-7',
  'ipAddresses': [],
  'status': 'DELETING',
  'created': '2026-02-11T16:29:25Z',
  'region': 'GRA9',
  'flavor': {'id': 'c5708c95-f450-43c3-8b56-7d498e7b5d07',
   'name': 'rtx5000-28',
   'region': 'GRA9',
   'ram': 28,
   'disk': 400,
   'vcpus': 4,
   'type': 'ovh.raid-nvme.t1',
   'osType': 'linux',
   'inboundBandwidth': 2000,
   'outboundBandwidth': 2000,
   'available': True,
   'planCodes': {'monthly': None,
    'hourly': 'rtx5000-28.consumption',
    'license': None},
   'capabilities': [{'name': 'resize', 'enabled': True},
    {'name': 'snapshot', 'enabled': True},
    {'name': 'volume', 'enabled': True},
    {'name': 'failoverip', 'enabled': True}],
   'quota': 7},
  'image': {'id': '8d595649-b9b2-4aeb-a544-a3709abf437f',
   'name': 'Ubuntu 24.04',
   'region': 'GRA9',
   'visibility': 'public',
   'type': 'linux',
   'minDisk': 0,
   'minRam': 0,
   'size': 4,
   'creationDate': '2025-11-05T10:08:13Z',
   'status': 'active',
   'user': 'ubuntu',
   'flavorType': None,
   'tags': [],
   'planCode': None},
  'sshKey': {'id': '5457466a4c56593d',
   'name': 'Mac-V',
   'regions': ['GRA9'],
   'fingerPrint': 'db:d2:44:36:a8:5a:61:e4:fd:3f:8c:d1:f3:7b:db:89',
   'publicKey': 'ssh-ed25519 SSH_KEY_VALUE YOUR_EMAIL_ADDRESS'},
  'monthlyBilling': None,
  'planCode': 'rtx5000-28.consumption',
  'licensePlanCode': None,
  'operationIds': [],
  'currentMonthOutgoingTraffic': None,
  'rescuePassword': None,
  'availabilityZone': None})

Project details


Download files

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

Source Distribution

ovhmanager-0.0.2.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

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

ovhmanager-0.0.2-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file ovhmanager-0.0.2.tar.gz.

File metadata

  • Download URL: ovhmanager-0.0.2.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ovhmanager-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a6788c9ecbd76549f3925da20b7042671142b25546b9618a86cc4293115f15c9
MD5 e56655dbccc7ec2179cf23898ffe3570
BLAKE2b-256 82cc517c47547f8653ad919ac586239c2c4b75d5a2ae7080436bae211940d932

See more details on using hashes here.

File details

Details for the file ovhmanager-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: ovhmanager-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ovhmanager-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1cac1ab161398ece136b9e5d14a66fbe998e7c9b7755c781101d79561280d447
MD5 7e740cdf60eca2e09e174a7d6174d756
BLAKE2b-256 fbca2daa23aed3f318bfda6ab43d14d8918d9571ebecc7f19a4721c0be11b59c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page