@runpod/typescript-api-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RunPod, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # Runpod REST API v2 — TypeScript SDK
2
+
3
+ A typed TypeScript/JavaScript client for **Runpod REST API v2**
4
+ (`https://api.runpod.io/v2`). Manage pods, clusters,
5
+ Serverless endpoints, templates, network volumes, registries, catalog, SSH keys,
6
+ and billing.
7
+
8
+ [REST v2 API docs](https://api.runpod.io/v2/docs) ·
9
+ [OpenAPI spec](https://api.runpod.io/v2/openapi.json) ·
10
+ [Runpod plugin](https://github.com/runpod/runpod-plugins-official) ·
11
+ [MCP server](https://github.com/runpod/runpod-mcp)
12
+
13
+ Supports **Node.js 20+**, ESM, and CommonJS. For Serverless job submission and
14
+ results, use the existing [runpod-sdk](https://github.com/runpod/js-sdk).
15
+
16
+ ## Using an AI agent instead?
17
+
18
+ The **[Runpod plugin](https://github.com/runpod/runpod-plugins-official#install)**
19
+ adds Runpod skills and tools to your agent. In Claude Code:
20
+
21
+ ```text
22
+ /plugin marketplace add runpod/runpod-plugins-official
23
+ /plugin install runpod@runpod
24
+ /reload-plugins
25
+ ```
26
+
27
+ Authenticate through `/mcp` → **runpod** → **Sign in with Runpod**.
28
+ [Install for other agents](https://github.com/runpod/runpod-plugins-official#install).
29
+
30
+ For **[MCP tools only](https://github.com/runpod/runpod-mcp#quick-start)**,
31
+ run the guided installer and follow its connection/authentication prompts:
32
+
33
+ ```bash
34
+ npx @runpod/mcp-server@latest add
35
+ ```
36
+
37
+ These alternatives let an agent manage Runpod without integrating this SDK.
38
+
39
+ ## Install from npm
40
+
41
+ Once the first release is published, install the SDK in your app:
42
+
43
+ ```bash
44
+ npm install @runpod/typescript-api-sdk
45
+ ```
46
+
47
+ Or with pnpm:
48
+
49
+ ```bash
50
+ pnpm add @runpod/typescript-api-sdk
51
+ ```
52
+
53
+ Then [create a client with your API key](#use-it-in-your-app). Node.js 20+ is
54
+ required; Python and the source build tools are not needed to use the npm package.
55
+
56
+ ## Build from source
57
+
58
+ To build from source, install **Node.js 24** and **pnpm 11**. Python is only needed
59
+ when regenerating types or running the spec tests.
60
+
61
+ From the SDK checkout:
62
+
63
+ ```bash
64
+ pnpm install --frozen-lockfile
65
+ pnpm build
66
+ cp .env.example .env
67
+ ```
68
+
69
+ Set `RUNPOD_API_KEY` in `.env`, then run a read-only request to list GPU types:
70
+
71
+ ```bash
72
+ node --env-file=.env examples/catalog.mjs
73
+ ```
74
+
75
+ ### Install a local build
76
+
77
+ Create a local package from the SDK checkout:
78
+
79
+ ```bash
80
+ npm pack
81
+ ```
82
+
83
+ Then install that file **in your app's directory**, using the tarball path printed
84
+ by `npm pack`:
85
+
86
+ ```bash
87
+ npm install /path/to/package.tgz
88
+ ```
89
+
90
+ ## Use it in your app
91
+
92
+ After installing from npm or a local build, pass your API key when creating a
93
+ client and make a request:
94
+
95
+ ```ts
96
+ import { createRunpodClient } from "@runpod/typescript-api-sdk";
97
+
98
+ const client = createRunpodClient({ apiKey: "YOUR_API_KEY" });
99
+ const { data, response } = await client.GET("/v2/catalog/gpus", {
100
+ signal: AbortSignal.timeout(15_000),
101
+ });
102
+
103
+ if (!response.ok) throw new Error(`Runpod request failed: ${response.status}`);
104
+ if (!data) throw new Error("Runpod returned no data");
105
+ console.log(data.gpus);
106
+ ```
107
+
108
+ The client retries transient failures by default; pass `{ retry: false }` to disable retries.
109
+ Use `response.ok` to check HTTP status. Network, timeout, and parsing failures
110
+ reject the promise. A **30-second deadline** covers retries and response-body
111
+ consumption; configure `timeoutMs` or set it to `false` for long-lived streams.
112
+ The SDK does not load `.env` automatically. Keep API keys in server-side code.
113
+
114
+ ## One API key per client
115
+
116
+ Each call to `createRunpodClient` creates an independent client. Pass `apiKey`
117
+ to configure credentials for that instance; requests send it as
118
+ `Authorization: Bearer <apiKey>`.
119
+
120
+ ```ts
121
+ import { createRunpodClient } from "@runpod/typescript-api-sdk";
122
+
123
+ const clientA = createRunpodClient({ apiKey: "YOUR_FIRST_API_KEY" });
124
+ const clientB = createRunpodClient({ apiKey: "YOUR_SECOND_API_KEY" });
125
+
126
+ const podsA = await clientA.GET("/v2/pods"); // Uses the first key
127
+ const podsB = await clientB.GET("/v2/pods"); // Uses the second key
128
+ ```
129
+
130
+ Create as many clients as you need. Each keeps its own credentials and options;
131
+ creating another client does not change existing clients. Load real keys from
132
+ server-side configuration or a secret store rather than committing them to code.
133
+
134
+ If you omit `apiKey`, the client reads `RUNPOD_API_KEY` from the environment when
135
+ it is created. An explicit `apiKey` takes precedence. For example:
136
+
137
+ ```ts
138
+ const client = createRunpodClient(); // Uses RUNPOD_API_KEY
139
+ ```
140
+
141
+ ## More
142
+
143
+ - [Client guide](docs/client.md): options, errors, retries, CommonJS, and log streams.
144
+ - [Logging guide](docs/logging.md): structured events, cancellation, and parser limits.
145
+ - [Examples](examples): runnable catalog and pod-log requests.
146
+ - [Development](docs/development.md): tests, type generation, and spec-update automation.
147
+
148
+ MIT — [License](LICENSE) · [Third-party notices](THIRD_PARTY_NOTICES.txt)
@@ -0,0 +1,47 @@
1
+ This package bundles openapi-fetch (https://github.com/openapi-ts/openapi-typescript).
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2023 Drew Powers
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+
25
+ This package also bundles structured-headers (https://github.com/evert/structured-headers).
26
+
27
+ MIT License
28
+
29
+ Copyright (c) 2018-2026 Evert Pot
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy
32
+ of this software and associated documentation files (the "Software"), to deal
33
+ in the Software without restriction, including without limitation the rights
34
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
+ copies of the Software, and to permit persons to whom the Software is
36
+ furnished to do so, subject to the following conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in all
39
+ copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.