De Trooper AI API biedt uitgebreide toegang tot GPU-serverbeheer, inclusief serverprovisioning, monitoring, migratie en administratieve functies. Deze RESTful API stelt u in staat om uw GPU-infrastructuur programmatisch te beheren, serverbestellingen te maken en te monitoren, templates te verwerken en administratieve taken uit te voeren.
API-eindpunten en de API-documentatie bevinden zich momenteel in bèta. Neem bij eventuele problemen contact met ons op: Contacten.
Je vindt je API-sleutel in de API Console.
Pro Tip: Geef deze documentatie simpelweg aan je Development LLM Agent en het zal het in je code integreren.
Krijg een kort overzicht van de API basisprincipes zoals URL, authenticatie en meer:
https://james.trooper.ai
De meeste eindpunten vereisen Bearer token authenticatie met uw Trooper API-sleutel:
Authorization: Bearer YOUR_API_KEY
Haal je API-sleutel op van API Console.
Alle API-antwoorden zijn in JSON-formaat. Succesvolle antwoorden bevatten doorgaans:
success: Boolean die het succes van de operatie aangeeftFoutmeldingen bevatten:
error: Beschrijving van de foutnextOptioneel veld dat de volgende actie suggereert (bijv. “inloggen”)GET /api/test
Eenvoudig test-eindpunt om de API-connectiviteit te verifiëren.
GET /api/test
{
"test": "meinstring5"
}
GET /api/blibs
Haal alle publiek beschikbare GPU-serverconfiguraties op.
GET /api/blibs
Authorization: Bearer YOUR_API_KEY # Optional - includes your private networks if provided
[
{
"id": 1,
"name": "powerai.example",
"gpu_type": "RTX 4090",
"gpu_num": 1,
"gpu_ram": 24,
"cpu_cores": 8,
"cpu_ram": 32,
"hdd": 500,
"price_h": 0.85,
"is_public": 1,
"country_code": "DE",
"is_available": true,
"available_hosts": ["ai18", "ai89"],
"fitCount": 2,
"maxPossibleInstances": 5
}
]
{
"error": "Error fetching Blibs"
}
GET /api/blibs-private
Haal GPU-servers op die toegankelijk zijn voor uw account, inclusief privéconfiguraties.
GET /api/blibs-private
Authorization: Bearer YOUR_API_KEY
[
{
"id": 2,
"name": "RTX 4090 Dual Private",
"gpu_type": "RTX 4090",
"gpu_num": 2,
"gpu_ram": 24,
"cpu_cores": 16,
"cpu_ram": 64,
"hdd": 1000,
"price_h": 1.65,
"is_public": 1,
"country_code": "DE"
}
]
{
"error": "Missing or invalid Authorization header"
}
POST /api/order
Maak een nieuwe GPU-serverorder aan. U dient de aangegeven prijs in te dienen, anders wordt de bestelling niet geaccepteerd. Dit zorgt ervoor dat de huidige prijs overeenkomt met uw verwachtingen!
Open API Console & Probeer het uit
POST /api/order
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"blib_id": 1,
"price_h": 0.85,
"total_price": 0.85,
"terms_accepted": true,
"contract_interval": "HOUR",
"second_partition_percentage": 20,
"templates": [
{
"id": 1,
"name": "PyTorch Environment"
}
]
}
{
"success": true,
"orderId": 123
}
{
"error": "You must accept the terms and conditions."
}
{
"error": "Invalid or missing contract interval."
}
GET /api/orders
Haal al uw serverbestellingen op met gedetailleerde informatie.
Houd bij het afhandelen van serverstatussen rekening met de wisselwerking tussen desired_status en current_statusBijvoorbeeld, een server kan een desired_status van “gestopt”, maar zijn current_status kan nog steeds “running” zijn als het stop-proces nog bezig is. Uw applicatie moet rekening houden met deze overgangen en hierop inspelen.
GET /api/orders
Authorization: Bearer YOUR_API_KEY
machine_name (optioneel): Filter op specifieke machinenaam[
{
"order_id": 123,
"serverId": 123,
"title": "My PyTorch Server",
"status": "running",
"status_user": "running",
"server_name": "gpu-server-01",
"machine_name": "ai99_trooperai_000123",
"ip": "192.168.1.100",
"ssh_port": 22001,
"price_h": 0.85,
"paid_until": "2025-09-26T14:30:00.000Z",
"contract_interval": "HOUR",
"is_locked": false,
"is_low_priority": false,
"blib_name": "RTX 4090 Single",
"blib_gpu_type": "RTX 4090",
"blib_gpu_num": 1,
"country_code": "DE",
"template_installs": [
{
"id": 1,
"template_name": "PyTorch Environment",
"status": 1,
"status_readable": "Completed"
}
]
}
]
{
"error": "Missing or invalid Authorization header",
"next": "login"
}
POST /api/order-status
Update de status van uw serverbestelling (actief, gestopt, opnieuw opgestart, gepauzeerd).
Instellen "migration_allowed": true als u hostmigratie goedkeurt wanneer u van een bevroren naar een actieve status overgaat. Dit proces kan 10–90 minuten duren en zal de poortbereik en mogelijk het CPU-model/de snelheid wijzigen.
POST /api/order-status
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123,
"desired_status": "running",
"migration_allowed": false
}
{
"success": true,
"updated": 1
}
{
"success": false,
"error": "Server is locked and cannot be modified"
}
POST /api/order-title
Wijzig de weergavenaam van uw server.
POST /api/order-title
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123,
"title": "My New Server Title"
}
{
"success": true,
"message": "Title updated successfully"
}
POST /api/order-lock
Blokkeer of deblokkeer een server om statuswijzigingen te voorkomen/toestaan.
POST /api/order-lock
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123,
"is_locked": true
}
{
"success": true,
"updated": 1
}
POST /api/credentials
Haal SSH-inloggegevens en verbindingsdetails voor uw server op.
POST /api/credentials
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123
}
{
"success": true,
"ssh_password": "generated-password"
}
{
"error": "Access denied or server not found"
}
GET /api/order-status-history
Haal de laatste 5 statuswijzigingen voor een serverbestelling op.
GET /api/order-status-history?order_id=123
Authorization: Bearer YOUR_API_KEY
{
"success": true,
"history": [
{
"id": 1,
"status_user": "running",
"status_txt": "Server started successfully",
"status_since": "2025-09-25T10:30:00.000Z"
},
{
"id": 2,
"status_user": "stopped",
"status_txt": "Server stopped by user",
"status_since": "2025-09-25T08:15:00.000Z"
}
]
}
Migratie wordt gebruikt om uw GPU-server naar een andere configuratie te brengen. We raden het niet aan om dit voor productie te gebruiken. Maar u kunt het proberen als u wilt!
GET /api/migration-options
Haal beschikbare serverconfiguraties op voor migratie.
GET /api/migration-options?order_id=123
Authorization: Bearer YOUR_API_KEY
{
"success": true,
"currentOrder": {
"id": 123,
"title": "My Server",
"status": "running",
"contract_interval": "HOUR",
"paid_until": "2025-09-26T14:30:00.000Z"
},
"currentBlib": {
"id": 1,
"name": "RTX 4090 Single",
"gpu_type": "RTX 4090",
"gpu_num": 1,
"price_h": 0.85
},
"availableBlibs": [
{
"id": 2,
"name": "RTX 4090 Dual",
"gpu_type": "RTX 4090",
"gpu_num": 2,
"price_h": 1.65,
"is_available": true,
"additionalCostPerCycle": 0.80
}
]
}
POST /api/migration-cost
Bereken de kosten voor het migreren naar een andere serverconfiguratie.
POST /api/migration-cost
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"order_id": 123,
"target_blib_id": 2
}
{
"success": true,
"upgradeCost": 15.50,
"remainingValue": 12.30,
"totalDue": 3.20,
"additionalCostPerCycle": 0.80,
"nextBillingDate": "2025-09-26T14:30:00.000Z",
"currentRate": {
"amount": 0.85,
"display": "€0.85/hour"
},
"newRate": {
"amount": 1.65,
"display": "€1.65/hour"
}
}
POST /api/buy-migration
Voer de migratie uit naar een nieuwe serverconfiguratie.
BELANGRIJK Als u hier ongeldige gegevens invoert, is er niets gegarandeerd. Het supportteam kan uw bestelling niet herstellen als u dit eindpunt misbruikt om migraties te kopen. We raden aan om het UI Dashboard te gebruiken.
POST /api/buy-migration
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"order_id": 123,
"target_blib_id": 2,
"keep_data": true
}
{
"success": true,
"message": "Migration initiated successfully",
"new_order_id": 124
}
{
"error": "Insufficient budget for migration"
}
GET /api/templates
Haal alle beschikbare softwaretemplates op.
GET /api/templates
Authorization: Bearer YOUR_API_KEY # Optional
[
{
"id": 1,
"name": "PyTorch Environment",
"description": "Pre-configured PyTorch environment with CUDA support",
"category": "Machine Learning",
"is_public": true,
"options": [
{
"id": 1,
"name": "Python Version",
"type": "select",
"default_value": "3.9",
"possible_values": "3.8,3.9,3.10"
}
]
}
]
GET /api/template-config
Haal de template-installatieconfiguratie op voor een specifieke bestelling.
GET /api/template-config?order_id=123
Authorization: Bearer YOUR_API_KEY
{
"success": true,
"templates": [
{
"install_id": 1,
"template_id": 1,
"template_name": "PyTorch Environment",
"status": 1,
"status_readable": "Completed",
"config": {
"python_version": "3.9"
}
}
]
}
POST /api/template-install-add
Installeer een nieuwe template op uw server.
POST /api/template-install-add
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"order_id": 123,
"template_id": 1,
"config": {
"python_version": "3.9"
}
}
{
"success": true,
"install_id": 5,
"message": "Template installation queued"
}
POST /api/template-install-delete
Verwijder een template-installatie van uw server.
POST /api/template-install-delete
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"install_id": 5
}
{
"success": true,
"message": "Template removal initiated"
}
POST /api/template-install-retry
Een mislukte template-installatie opnieuw proberen.
POST /api/template-install-retry
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"install_id": 5
}
{
"success": true,
"message": "Template installation retry initiated"
}
"Missing or invalid Authorization header": Authenticatie vereist"Invalid Trooper key": API sleutel is ongeldig"Unauthorized access"Onvoldoende rechten"You must accept the terms and conditions": Voorwaarden niet geaccepteerd bij ordercreatie"Invalid or missing contract interval"Contractinterval moet UUR, WEEK of MAAND zijn"Insufficient budget"Onvoldoende budget"Server is locked and cannot be modified": Server is vergrendeld voor wijzigingenAPI-eindpunten kunnen worden beperkt om misbruik te voorkomen. Als u de limiet overschrijdt, ontvangt u een statuscode 429. Implementeer een geschikte herhaallogica met exponentiële backoff.
Neem voor API-ondersteuning en vragen contact op met: support@trooper.ai
Neem voor vragen over de API contact met ons op: Contacten