TypeScript
The TypeScript client uses HTTP/JSON (grpc-gateway). PlatformClient is the
typed wrapper shared by the web console.
import { PlatformClient } from '@platform/api-client';
const client = new PlatformClient({ baseUrl: 'http://cloud-api.localhost', token: process.env.PLATFORM_TOKEN,});const instances = await client.listInstances();const types = await client.listInstanceTypes();On a local apiserver without compose, use baseUrl: 'http://127.0.0.1:8080'.
PLATFORM_REST is the default when baseUrl is omitted (Node). token also
falls back to PLATFORM_TOKEN.
Install
Section titled “Install”The package is @platform/api-client in frontend/packages/api-client. It is
a workspace package (not published to npm).
Needs Node 22+. From this repository’s frontend/
workspace:
pnpm add @platform/api-clientnpm install @platform/api-client and yarn add @platform/api-client also
work inside that workspace.
Needs Node 22+. From this repository’s frontend/
workspace:
pnpm add @platform/api-clientnpm install and yarn add work the same way.
Install Node 22+ (LTS). In PowerShell, from this
repository’s frontend/ workspace:
pnpm add @platform/api-clientOr npm install @platform/api-client. Restart the terminal after installing
Node if the command is not found.