PlanGate
Type to search every docs page
↑ ↓ to move↵ to openesc to close
DocsSign in

Getting started

In about ten minutes you will set up an app on PlanGate, sign in as one of its users and get a first answer from your AI model, paid for by a free plan. You need a key from an AI provider, a browser and a terminal with curl.

PlanGate gives you 30 free days, no card needed. Nothing in this tutorial takes real payments.

1. Create the app

Sign in to PlanGate, open the panel and choose New app. Name it my-agent, pick your provider, and create it.

The panel now shows the app's API address, https://api.plangate.dev/my-agent/v1. The part after the domain, my-agent, is the app's short name: every call below uses it.

2. Add your provider key

The panel walks a new app through its launch: first, paste your provider key. PlanGate checks it and lists the models it can use, with the price billed for each.

Open Models and tick one model. Note its name: you will ask for it in step 5.

3. Offer a free plan

Open the Plans tab. Under New plan, name the plan Free, tick Free plan, and enter:

  • Monthly budget: 5
  • Minimum per user per day: 0.10

Choose Offer it. Every user of my-agent without a paid plan can now use up to $0.10 of AI a day, and the whole plan never costs you more than $5 a month.

4. Sign in as a user

Open this address in your browser:

https://account.plangate.dev/connect?app=my-agent&return=http://localhost:8765/&state=tutorial

You see a sign-in page in your app's name. Sign in with Google or Apple. The browser then tries to open http://localhost:8765/…: nothing listens there, so the page doesn't load, and that is expected. Look at the address bar instead:

http://localhost:8765/?access_token=eyJ…&refresh_token=…&expires_in=3600&state=tutorial

Copy the value of access_token and keep it in your terminal:

export TOKEN="eyJ…"

This token is your session as a user of my-agent. It lasts an hour.

5. Ask the model

Replace <model> with the model you ticked in step 2:

curl https://api.plangate.dev/my-agent/v1/chat/completions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model": "<model>", "messages": [{"role": "user", "content": "Say hello in five words."}]}'

The answer comes back in OpenAI's Chat Completions format:

{"choices": [{"message": {"role": "assistant", "content": "Hello there, nice to meet!"}, …}], …}

Your provider key never left PlanGate. Your user only held their own token.

6. See what it cost

Ask PlanGate what this user has left:

curl https://api.plangate.dev/apps/my-agent/me -H "Authorization: Bearer $TOKEN"

quota.free is true, budget_week_usd is today's share of the free plan and used_week_usd what your question cost. In the panel, the app's Overview tab shows the same spending.

Next steps

❌🕸️