subscribe_to_plan
Subscribe to a plan on the402.ai marketplace using pre-funded balance for bundled AI services with auto-renewal.
Instructions
Subscribe to a plan on the402.ai. Pays the first billing period from your pre-funded balance. Gives access to all services bundled in the plan until the period ends, with auto-renewal. Requires API key.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan_id | Yes | The plan ID to subscribe to |
Implementation Reference
- src/tools/subscriptions.ts:27-41 (handler)The "subscribe_to_plan" tool is defined and registered here. The handler logic directly makes a balance-authorized POST request to the API.
server.tool( "subscribe_to_plan", "Subscribe to a plan on the402.ai. Pays the first billing period from your pre-funded balance. Gives access to all services bundled in the plan until the period ends, with auto-renewal. Requires API key.", { plan_id: z.string().describe("The plan ID to subscribe to"), }, async ({ plan_id }) => { const result = await client.balancePost(`/v1/plans/${plan_id}/subscribe`); return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2) }, ], }; } );