Bienvenue dans la documentation de l’API NOSGPU. Cette documentation constitue un guide complet pour les développeurs souhaitant intégrer notre plateforme. Notre API permet d’intégrer facilement les fonctionnalités de NOSGPU dans leurs applications.
Pour commencer à utiliser notre API, familiarisez-vous avec les points de terminaison et les mécanismes d’authentification proposés. Voici les informations essentielles pour démarrer :
https://api.nosgpu.ch/sandbox/v1https://api.nosgpu.ch/v1Les exemples utilisent l’API de production. Pour utiliser la sandbox, remplacez l’URL de base de production par celle de la sandbox.
L’accès à l’API NOSGPU nécessite une authentification par clé API. Suivez ces étapes pour obtenir votre clé :
Les clés publiques SSH peuvent uniquement être ajoutées sur le site, pas via l’API publique. Enregistrez votre clé avant de créer une instance avec l’API.
Récupérer le solde actuel du portefeuille et la devise.
const API_KEY = 'YOUR_BEARER_API_KEY';
const URL = 'https://api.nosgpu.ch/v1/account/balance';
fetch(URL, {
method: 'GET',
headers: {
'Authorization': 'Bearer ' + API_KEY,
'Content-Type': 'application/json'
}
})
.then(async (response) => {
const data = await response.json();
if (!response.ok) {
throw new Error(JSON.stringify(data));
}
console.log('Balance:', data.balance);
console.log('Currency:', data.currency);
})
.catch((error) => {
console.error('Error fetching balance:', error.message);
});
GET
URL de l’API : https://api.nosgpu.ch/v1/account/balance
Authorization: obligatoire – jeton Bearer
Content-Type: facultatif – application/json
Réponse réussie
{
// current user balance
"balance": number,
"currency": {
// currency code
"code": 'USD'|'EUR'|'GBP'|'CHF',
// currency symbol
"symbol": '$'|'€'|'£'|'CHF'|null
}
}
Non autorisé– Vérifiez que votre jeton Bearer est correct
Cette API renvoie toutes les offres d’instances à louer, regroupées par catégorie, avec la disponibilité, les ressources matérielles, les systèmes d’exploitation, les modèles et les prix.
const API_KEY = 'YOUR_BEARER_API_KEY';
const URL = 'https://api.nosgpu.ch/v1/catalog/packages';
fetch(URL, {
method: 'GET',
headers: {
'Authorization': 'Bearer ' + API_KEY,
'Content-Type': 'application/json'
}
})
.then(async (response) => {
const data = await response.json();
if (!response.ok) {
throw new Error(JSON.stringify(data));
}
console.log('Categories:', data.categories);
console.log('Currency:', data.currency);
})
.catch((error) => {
console.error('Error fetching catalog packages:', error.message);
});
GET
URL de l’API : https://api.nosgpu.ch/v1/catalog/packages
Authorization: obligatoire – jeton Bearer
Content-Type: facultatif – application/json
Réponse réussie
{
"categories": {
"vm_gpu_dedicated": {
"packages": [
{
// package id
"id": number,
"availability": {
// 1 if package is available, 0 otherwise
"available": 0|1,
// availability reason if not available
"reason": string|null
},
"cpu": {
// cpu brand
"brand": string|null,
// cpu model name
"name": string|null,
// number of cpu cores
"cores": number|null
},
"ram": {
// ram quantity
"quantity": string|null,
// ram unit
"unit": 'GB'
},
"disk": {
// disk type
"type": string|null,
// disk quantity
"quantity": number|null,
// disk unit
"unit": 'GB'
},
"gpu": {
// gpu brand
"brand": string|null,
// gpu model name
"name": string|null,
// gpu vram quantity
"vram_quantity": string|null,
// gpu vram unit
"vram_unit": 'GB',
// dedicated gpu quantity for dedicated packages
"quantity"?: number,
// shared gpu slice quantity for shared packages
"slice_quantity"?: number,
// total slice quantity available on source gpu
"slice_quantity_of"?: number|null,
// source gpu total vram quantity for shared packages
"vram_quantity_of"?: string|null
},
"os": [
{
// operating system brand
"brand": string,
// operating system version
"version": string,
"templates": [
{
// image id used when creating an instance
"image_id": number,
// template name
"name": string
}
]
}
],
// package tag
"tag": string,
"price": {
// billing unit
"unit": 'h'|'m',
// billing amount
"amount": number
}
}
]
},
"vm_gpu_shared": {
"packages": array
},
"bare_metal": {
"packages": array
},
"cold_storage": {
"packages": array
},
"ai_storage": {
"packages": array
}
},
"currency": {
// account currency code
"code": 'EUR'|'CHF'|'USD',
// currency symbol
"symbol": string|null
}
}
Non autorisé– Vérifiez que votre jeton Bearer est correct
Cette API crée une nouvelle instance GPU avec l’offre, l’image et la clé SSH sélectionnées.
const API_KEY = 'YOUR_BEARER_API_KEY';
const URL = 'https://api.nosgpu.ch/v1/instances/create';
fetch(URL, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
package_id: 1, // API GET https://api.nosgpu.ch/v1/catalog/packages: categories[category].packages[].id
image_id: 1, // API GET https://api.nosgpu.ch/v1/catalog/packages: categories[category].packages[].os[].templates[].image_id (selected package)
ssh_key_id: 1 // Website only: add your public key at https://www.nosgpu.ch/dashboard/account/ssh-key and copy its ID
})
})
.then(async (response) => {
const data = await response.json();
if (!response.ok) {
throw new Error(JSON.stringify(data));
}
// Success
console.log('Instance created:', data.instance);
console.log('My updated wallet balance:', data.wallet);
})
.catch((error) => {
console.error('Error during creation:', error.message);
});
POST
URL de l’API : https://api.nosgpu.ch/v1/instances/create
Authorization: obligatoire – jeton Bearer
Content-Type: obligatoire – application/json
package_id: obligatoire – ID de l’offre dans la réponse JSON à GET https://api.nosgpu.ch/v1/catalog/packages: categories[category].packages[].id.
image_id: obligatoire – ID du modèle de système d’exploitation dans la même réponse du catalogue : categories[category].packages[].os[].templates[].image_id. Choisissez un modèle appartenant à l’offre sélectionnée.
ssh_key_id: obligatoire – ID de la clé SSH enregistrée sur le site, sur la page Clés SSH. Ajoutez d’abord la clé publique sur cette page, puis copiez son ID comme décrit dans Clés SSH : configuration sur le site.
Ici, category est un nom de catégorie de la réponse (par exemple vm_gpu_dedicated), et [] désigne un élément d’un tableau. Il s’agit de chemins dans la réponse JSON, pas d’URL. La valeur 1 des exemples est un espace réservé pour chaque ID.
Réponse réussie
{
"instance": {
// your account id
"user_id": number,
// package id
"package_id": number,
// hypervisor id
"hypervisor_id": number,
// template id
"image_id": number,
// instance type id
"type": number,
// instance status code
"status": 'provisioning'|'running'|'stopped'|'error'|'deleting'|'deleted'|'expired',
// UTC date time
"updated_at": string,
// UTC date time
"created_at": string,
// instance id
"id": number,
// instance name
"name": string
},
"wallet": {
// your credit after instance creation
"balance": number,
"currency": {
// account/user currency code
"code": 'EUR'|'CHF'|'USD',
// currency symbol if available
"symbol": string|null
}
}
}
Non autorisé– Vérifiez que votre jeton Bearer est correct
Paiement requis– Solde ou crédits insuffisants
Erreur de validation– Paramètres du corps de la requête non valides
Cette API renvoie la liste paginée des instances de l’utilisateur authentifié, avec des filtres par catégorie, statut et période, ainsi que les données de suivi des coûts.
const API_KEY = 'YOUR_BEARER_API_KEY';
const LIMIT = 5;
const SKIP = 0;
const URL = 'https://api.nosgpu.ch/v1/instances/list/' + LIMIT + '/' + SKIP;
fetch(URL, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
category: 'all',
status: 'active',
date_from: '2026-02-24',
date_to: '2026-06-05'
})
})
.then(async (response) => {
const data = await response.json();
if (!response.ok) {
throw new Error(JSON.stringify(data));
}
console.log('Instances:', data.instances);
console.log('Total:', data.tot);
console.log('Currency:', data.currency);
})
.catch((error) => {
console.error('Error fetching instances list:', error.message);
});
POST
URL de l’API : https://api.nosgpu.ch/v1/instances/list/{limit}/{skip}
Authorization: obligatoire – jeton Bearer
Content-Type: obligatoire – application/json
limit: obligatoire – nombre maximal d’instances à renvoyer
skip: obligatoire – nombre d’enregistrements à ignorer pour la pagination
category: obligatoire – filtre de catégorie, all, vm_gpu_shared, vm_gpu_dedicated, bare_metal, ai_storage, cold_storage, all_storage, all_vm
status: obligatoire – filtre de statut, active, all, stopped, running, delete
date_from: facultatif – filtre de date de début au format YYYY-MM-DD
date_to: facultatif – filtre de date de fin au format YYYY-MM-DD
Réponse réussie
{
"instances": [
{
// instance id
"id": number,
// generated instance name
"name": string,
// instance type id
"type": number,
// instance category
"category": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
// current instance status
"status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
// total accumulated cost
"total_cost": number,
// partial cost in selected filter range
"partial_cost": number,
"price": {
// billing unit
"unit": string,
// price amount for billing unit
"amount": number
}
}
],
// total number of instances matching current filters
"tot": number,
"currency": {
// account currency code
"code": 'EUR'|'CHF'|'USD',
// currency symbol
"symbol": string|null
}
}
Non autorisé– Vérifiez que votre jeton Bearer est correct
Erreur de validation– Filtres ou paramètres de pagination non valides
Cette API renvoie les détails complets d’une instance GPU donnée : statut, facturation, ressources de l’offre, accès réseau et informations d’authentification.
const API_KEY = 'YOUR_BEARER_API_KEY';
const INSTANCE_ID = 1;
const URL = 'https://api.nosgpu.ch/v1/instances/' + INSTANCE_ID + '/details';
fetch(URL, {
method: 'GET',
headers: {
'Authorization': 'Bearer ' + API_KEY,
'Content-Type': 'application/json'
}
})
.then(async (response) => {
const data = await response.json();
if (!response.ok) {
throw new Error(JSON.stringify(data));
}
console.log('Instance details:', data.instance);
console.log('Currency:', data.currency);
})
.catch((error) => {
console.error('Error fetching instance details:', error.message);
});
GET
URL de l’API : https://api.nosgpu.ch/v1/instances/{instance_id}/details
Authorization: obligatoire – jeton Bearer
Content-Type: facultatif – application/json
instance_id: obligatoire – ID de l’instance
Réponse réussie
{
"instance": {
// instance id
"id": number,
// instance name
"name": string,
// instance type id
"type": number,
// category label
"category": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
// instance status code
"status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
// current task state if available
"task_state": string,
// UTC date time when instance started
"started_at": string|null,
"price": {
// billing unit
"unit": string,
// amount for billing unit
"amount": number
},
// accumulated total instance cost
"total_cost": number,
"address": {
// public ip address
"public_ip": string,
// exposed service interface port if available
"interface_port": string|null
},
"auth": {
// auth method
"type": 'ssh',
"value": {
// SSH public key content
"public_key": string,
// SSH key id
"id": number|null,
// SSH key name
"name": string|null
},
// default ssh username if available
"username": string|null
},
"billing": [
{
// negative or positive billing amount
"amount": number,
// UTC date time of billing record
"created_at": string
}
],
"metrics": {
// current metrics snapshot
"current": object|null,
// metrics history list
"history": array
},
"package": {
// package id snapshot
"id": number,
"cpu": {
"brand": string,
"name": string,
"cores": number
},
"ram": {
"quantity": string,
"unit": 'GB'
},
"disk": {
"type": string,
"quantity": number,
"unit": 'GB'
},
"gpu": {
"brand": string,
"name": string,
"vram_quantity": string,
"vram_unit": 'GB',
"slice_quantity": number,
"slice_quantity_of": number|null,
"vram_quantity_of": number|null
},
"os": {
"brand": string,
"version": string,
"template": {
"image_id": number,
"name": string
}
},
"tag": string
}
},
"currency": {
// account/user currency code
"code": 'EUR'|'CHF'|'USD',
// currency symbol if available
"symbol": string|null
}
}
Non autorisé– Vérifiez que votre jeton Bearer est correct
Introuvable– Instance introuvable
Cette API exécute une action sur une instance donnée. Les actions prises en charge sont start, stop et reboot.
const API_KEY = 'YOUR_BEARER_API_KEY';
const INSTANCE_ID = 1;
const ACTION = 'start'; // start | stop | reboot
const URL = 'https://api.nosgpu.ch/v1/instances/' + INSTANCE_ID + '/' + ACTION;
fetch(URL, {
method: 'PATCH',
headers: {
'Authorization': 'Bearer ' + API_KEY,
'Content-Type': 'application/json'
}
})
.then(async (response) => {
const data = await response.json();
if (!response.ok) {
throw new Error(JSON.stringify(data));
}
console.log('Instance action result:', data.instance);
})
.catch((error) => {
console.error('Error executing instance action:', error.message);
});
PATCH
URL de l’API : https://api.nosgpu.ch/v1/instances/{instance_id}/{action}
Authorization: obligatoire – jeton Bearer
Content-Type: facultatif – application/json
instance_id: obligatoire – ID de l’instance
action: obligatoire – les valeurs prises en charge sont start, stopet reboot
Réponse réussie
{
"instance": {
// instance id
"id": number,
// generated instance name
"name": string,
// instance category/type label
"type": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
// current instance status after action
"status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
// instance start datetime in UTC if available
"started_at": string|null
}
}
Non autorisé– Vérifiez que votre jeton Bearer est correct
Introuvable– Instance introuvable
Conflit– L’instance n’est pas prête pour cette action
Cette API supprime une instance donnée et renvoie son statut mis à jour.
Attention : supprimer une instance détruit définitivement la machine et toutes les données qu’elle contient. Cette action est irréversible. Sauvegardez les données nécessaires avant de continuer.
La suppression de l’instance arrête les débits de crédits ultérieurs pour cette instance.
const API_KEY = 'YOUR_BEARER_API_KEY';
const INSTANCE_ID = 1;
const URL = 'https://api.nosgpu.ch/v1/instances/' + INSTANCE_ID;
fetch(URL, {
method: 'DELETE',
headers: {
'Authorization': 'Bearer ' + API_KEY,
'Content-Type': 'application/json'
}
})
.then(async (response) => {
const data = await response.json();
if (!response.ok) {
throw new Error(JSON.stringify(data));
}
console.log('Instance delete result:', data.instance);
})
.catch((error) => {
console.error('Error deleting instance:', error.message);
});
DELETE
URL de l’API : https://api.nosgpu.ch/v1/instances/{instance_id}
Authorization: obligatoire – jeton Bearer
Content-Type: facultatif – application/json
instance_id: obligatoire – ID de l’instance
Réponse réussie
{
"instance": {
// instance id
"id": number,
// generated instance name
"name": string,
// instance category/type label
"type": 'vm_gpu_dedicated'|'vm_gpu_shared'|'bare_metal'|'cold_storage'|'ai_storage',
// current instance status after delete action
"status": 'provisioning'|'running'|'starting'|'stopped'|'stopping'|'rebooting'|'error'|'deleting'|'deleted'|'expired',
// instance start datetime in UTC if available
"started_at": string|null
}
}
Non autorisé– Vérifiez que votre jeton Bearer est correct
Introuvable– Instance introuvable
Si vous rencontrez des problèmes ou avez des questions sur l’API NOSGPU, contactez notre équipe d’assistance.