Willkommen zur Dokumentation der NOSGPU-API. Diese Dokumentation bietet Entwicklern einen umfassenden Leitfaden zur Integration unserer Plattform. Über unsere API können Entwickler NOSGPU-Funktionen nahtlos in ihre Anwendungen integrieren.
Um unsere API zu nutzen, solltest du dich mit den Endpunkten und Authentifizierungsmechanismen vertraut machen. Hier findest du die wichtigsten Informationen für den Einstieg:
https://api.nosgpu.ch/sandbox/v1https://api.nosgpu.ch/v1Die Beispiele verwenden die Produktions-API. Ersetze für die Sandbox die Produktions-Basis-URL durch die Sandbox-Basis-URL.
Für den Zugriff auf die NOSGPU-API ist eine Authentifizierung per API-Schlüssel erforderlich. So erhältst du deinen API-Schlüssel:
Öffentliche SSH-Schlüssel können nur über die Website hinzugefügt werden, nicht über die öffentliche API. Registriere deinen Schlüssel, bevor du eine Instanz über die API erstellst.
Aktuelles Wallet-Guthaben und Währung abrufen.
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
API-URL: https://api.nosgpu.ch/v1/account/balance
Authorization: erforderlich – Bearer-Token
Content-Type: optional – application/json
Erfolgreiche Antwort
{
// current user balance
"balance": number,
"currency": {
// currency code
"code": 'USD'|'EUR'|'GBP'|'CHF',
// currency symbol
"symbol": '$'|'€'|'£'|'CHF'|null
}
}
Nicht autorisiert– Prüfe, ob dein Bearer-Token korrekt ist
Diese API liefert alle mietbaren Instanzpakete nach Kategorie, einschließlich Verfügbarkeit, Hardwareressourcen, Betriebssystemen, Vorlagen und Preisen.
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
API-URL: https://api.nosgpu.ch/v1/catalog/packages
Authorization: erforderlich – Bearer-Token
Content-Type: optional – application/json
Erfolgreiche Antwort
{
"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
}
}
Nicht autorisiert– Prüfe, ob dein Bearer-Token korrekt ist
Diese API erstellt eine neue GPU-Instanz mit dem gewählten Paket, Image und SSH-Schlüssel.
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
API-URL: https://api.nosgpu.ch/v1/instances/create
Authorization: erforderlich – Bearer-Token
Content-Type: erforderlich – application/json
package_id: erforderlich – Paket-ID aus der JSON-Antwort auf GET https://api.nosgpu.ch/v1/catalog/packages: categories[category].packages[].id.
image_id: erforderlich – ID der Betriebssystemvorlage aus derselben Katalogantwort: categories[category].packages[].os[].templates[].image_id. Wähle eine Vorlage, die zum gewählten Paket gehört.
ssh_key_id: erforderlich – ID des gespeicherten SSH-Schlüssels von der Website-Seite SSH-Schlüssel. Füge dort zuerst den öffentlichen Schlüssel hinzu und kopiere dann seine ID wie beschrieben unter SSH-Schlüssel: Einrichtung auf der Website.
Hier ist category ein Kategoriename aus der Antwort (z. B. vm_gpu_dedicated), und [] bezeichnet ein Array-Element. Dies sind Pfade innerhalb der JSON-Antwort, keine URLs. Der Wert 1 in den Beispielen dient als Platzhalter für die jeweilige ID.
Erfolgreiche Antwort
{
"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
}
}
}
Nicht autorisiert– Prüfe, ob dein Bearer-Token korrekt ist
Zahlung erforderlich– Unzureichendes Wallet-Guthaben oder Credits
Validierungsfehler– Ungültige Parameter im Anfrage-Body
Diese API liefert die paginierte Instanzliste des authentifizierten Benutzers mit Filtern für Kategorie, Status und Zeitraum sowie Daten zur Kostenüberwachung.
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
API-URL: https://api.nosgpu.ch/v1/instances/list/{limit}/{skip}
Authorization: erforderlich – Bearer-Token
Content-Type: erforderlich – application/json
limit: erforderlich – maximale Anzahl zurückzugebender Instanzen
skip: erforderlich – Anzahl zu überspringender Datensätze für die Paginierung
category: erforderlich – Kategoriefilter, all, vm_gpu_shared, vm_gpu_dedicated, bare_metal, ai_storage, cold_storage, all_storage, all_vm
status: erforderlich – Statusfilter, active, all, stopped, running, delete
date_from: optional – Startdatumfilter im Format YYYY-MM-DD
date_to: optional – Enddatumfilter im Format YYYY-MM-DD
Erfolgreiche Antwort
{
"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
}
}
Nicht autorisiert– Prüfe, ob dein Bearer-Token korrekt ist
Validierungsfehler– Ungültige Filter oder Paginierungsparameter
Diese API liefert vollständige Details zu einer bestimmten GPU-Instanz, einschließlich Status, Abrechnung, Paketressourcen, Netzwerkzugriff und Authentifizierungsinformationen.
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
API-URL: https://api.nosgpu.ch/v1/instances/{instance_id}/details
Authorization: erforderlich – Bearer-Token
Content-Type: optional – application/json
instance_id: erforderlich – Instanz-ID
Erfolgreiche Antwort
{
"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
}
}
Nicht autorisiert– Prüfe, ob dein Bearer-Token korrekt ist
Nicht gefunden– Instanz nicht gefunden
Diese API führt eine Aktion auf einer bestimmten Instanz aus. Unterstützte Aktionen sind start, stop und 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
API-URL: https://api.nosgpu.ch/v1/instances/{instance_id}/{action}
Authorization: erforderlich – Bearer-Token
Content-Type: optional – application/json
instance_id: erforderlich – Instanz-ID
action: erforderlich – unterstützte Werte sind start, stopund reboot
Erfolgreiche Antwort
{
"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
}
}
Nicht autorisiert– Prüfe, ob dein Bearer-Token korrekt ist
Nicht gefunden– Instanz nicht gefunden
Konflikt– Die Instanz ist für diese Aktion nicht bereit
Diese API löscht eine bestimmte Instanz und gibt ihren aktualisierten Status zurück.
Warnung: Das Löschen einer Instanz zerstört die Maschine und alle darauf gespeicherten Daten dauerhaft. Diese Aktion kann nicht rückgängig gemacht werden. Sichere benötigte Daten, bevor du fortfährst.
Das Löschen der Instanz beendet weitere Guthabenabbuchungen für diese Instanz.
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
API-URL: https://api.nosgpu.ch/v1/instances/{instance_id}
Authorization: erforderlich – Bearer-Token
Content-Type: optional – application/json
instance_id: erforderlich – Instanz-ID
Erfolgreiche Antwort
{
"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
}
}
Nicht autorisiert– Prüfe, ob dein Bearer-Token korrekt ist
Nicht gefunden– Instanz nicht gefunden
Bei Problemen oder Fragen zur NOSGPU-API kontaktiere unser Supportteam.