SDKs

Both clients are one file with no dependencies. Download them into your project and import them.

LanguageFileNeeds
TypeScript / JavaScript/sdk/prompt-tm.tsNode 18+, Bun, Deno or an edge runtime
Python/sdk/prompt_tm.pyPython 3.9+, standard library
curl -O https://www.prompt-tm.com/sdk/prompt-tm.ts
curl -O https://www.prompt-tm.com/sdk/prompt_tm.py

TypeScript

import { PromptTM, verifyWebhook } from "./prompt-tm"

const ptm = new PromptTM({ apiKey: process.env.PROMPT_TM_KEY! })

// Send a user to connect GitHub
const { redirect_url } = await ptm.connectedAccounts.link({ auth_config_id: "ac_...", user_id: "alice" })

// Run a tool as that user
const result = await ptm.tools.execute("GITHUB_LIST_REPOSITORIES", { user_id: "alice", arguments: { per_page: 5 } })
if (result.successful) console.log(result.data)

// A router session: an MCP URL, or the meta tools over REST
const session = await ptm.sessions.create({ user_id: "alice" })
const found = await ptm.sessions.execute(session.session_id, "PTM_SEARCH_TOOLS", { query: "open a GitHub issue" })

// In your webhook handler
const ok = await verifyWebhook(process.env.PROMPT_TM_WEBHOOK_SECRET!, request.headers, await request.text())

A failed tool call comes back as { successful: false, error }, not an exception, so an agent loop can hand the error to the model. API errors (bad key, unknown id) throw PromptTMError.

Python

from prompt_tm import PromptTM, verify_webhook

ptm = PromptTM(api_key=os.environ["PROMPT_TM_KEY"])
result = ptm.execute("GITHUB_LIST_REPOSITORIES", user_id="alice", arguments={"per_page": 5})
openai_tools = ptm.tools(toolkit_slug="github", fmt="openai")
session = ptm.session("alice")            # session["mcp"]["url"]
ptm.post("/connected_accounts/link", {"auth_config_id": "ac_...", "user_id": "alice"})

ptm.get, ptm.post, ptm.put, ptm.patch and ptm.delete reach every endpoint in the API reference.