Rent GPU servers by API: built for scripts and AI agents
You can now rent and manage SwissGPU servers from your own code. The customer API covers the whole rental lifecycle: check capacity, create a rental, follow the installation, read the connection details, reinstall, and release the server.
It is a plain REST API with JSON responses. That makes it usable from a shell script, a CI job, your own application, or an AI agent that acts on your behalf.
At a glance
- Base URL:
https://www.swissgpu.ch/api/v1, JSON over HTTPS. - Authentication: bearer tokens that you create in your account, each limited to the permissions and expiry you choose.
- Scope: account credit, capacity, images, rentals, shared IPv4, operations and billing records.
- Asynchronous: a create request returns
202 Acceptedwith an operation to poll and guidance on what to do next. - Documented for people and machines: a step-by-step guide, an OpenAPI schema and a Markdown version of every page.
What the API covers
| Action | Request | Token permission |
|---|---|---|
| Read your account and available credit | GET /me | account:read |
| Check which GPU models can be rented now | GET /capacity | rentals:read |
| List the images you can install | GET /images | rentals:read |
| Rent a server | POST /rentals | rentals:create |
| Read rentals and connection details | GET /rentals/{id} | rentals:read |
| Follow an accepted action | GET /operations/{id} | rentals:read |
| Enable or disable shared IPv4 | PUT /rentals/{id}/ipv4 | rentals:ipv4 |
| Erase and reinstall a server | POST /rentals/{id}/reinstall | rentals:reinstall |
| End a rental and stop its billing | DELETE /rentals/{id} | rentals:terminate |
| Read your wallet transactions | GET /transactions | billing:read |
| Download a transaction report as PDF | GET /reports/transactions | billing:read |
The customer API guide lists every endpoint, field and error code.
Rent a server with one request
A rental request names a GPU model, an image, a server password and the highest hourly rate you accept, in CHF cents:
POST /api/v1/rentals
Authorization: Bearer YOUR_TOKEN
Idempotency-Key: my-first-rental-001
Content-Type: application/json
{
"gpu": "RTX5090",
"image": "ubuntu:26.04",
"password": "YOUR_SERVER_PASSWORD",
"max_hourly_cents": 50,
"ipv4": false
}The response is 202 Accepted with an operation ID and a rental ID. Accepted does not mean ready: poll the operation and allow around 20 to 30 minutes for installation. When the rental state is ready, it contains the SSH username and hostname. To stop billing, send a DELETE for the rental. Powering off the server does not end a rental.
The guide has the complete walkthrough, with copy-ready commands that keep tokens and passwords out of your shell history.
Built so automation stays safe
An API that spends money needs guard rails, especially when an agent calls it. These are part of the contract:
- Scoped tokens. A token only carries the permissions you select. A monitoring script can read rentals without being able to create or end one. You can revoke a token at any time.
- A price ceiling on every rental.
max_hourly_centsis checked when capacity is claimed. The API does not accept a higher rate than the one you set. - Safe retries. Create, reinstall and terminate require an
Idempotency-Key. After a timeout, you resend the same request with the same key instead of starting a second action. - Explicit next steps. Every operation and rental response includes
guidancewith anext_actionsuch aswait,connectorcontact_support, and a recommended polling delay. - The account owner stays in control. Funding and token creation remain on the website, and passwords are never returned by the API.
For AI agents
Agents work best with precise, machine-readable instructions, so we publish them. The OpenAPI schema defines every request and response. Each documentation page has a Markdown version, and llms.txt indexes the pages that matter for evaluating and using the service.
Give an agent a token with only the permissions its task needs, and keep paid actions under your own approval: creating a rental, erasing a disk and ending a rental are decisions for the account owner. A capacity read is not a reservation and not permission to rent.
Good to know
- Amounts in authenticated endpoints are integer CHF cents.
max_hourly_cents: 50means CHF 0.50 per hour. - The hourly ceiling is not a total spending limit. Installation, electricity and optional shared IPv4 are separate; see the pricing page.
- Servers are installed with a password you choose. IPv6 is the default connection, and shared IPv4 is optional.
- Default limits are 120 reads and 10 changes per minute per account.
Get started
- Create an account, verify your email and add credit on the website.
- Open Account → API access and create a token with the permissions you need.
- Follow the customer API guide from the first capacity read to the final termination.
Only need prices? The public pricing API requires no account. Questions about an integration: info@swissgpu.ch.