To add SMS to a v0 app, save your Telmian key as TELMIAN_API_KEY in the v0 Vars panel, for Development and Production, never with NEXT_PUBLIC_. Then ask v0 for two Next.js route handlers: one calls /v1/verify to send a code, one calls /v1/verify/check. Test free in the sandbox, then top up and publish.
Get a free sandbox key
Create a Telmian account at https://app.telmian.com and get a sandbox key. It starts with sk_test_. No card is needed, and sandbox SMS are simulated, so nothing is sent or charged.
Save the key in v0 Vars
In v0, open the project menu (...) > Settings > Environment Variables (the Vars panel). Add TELMIAN_API_KEY and tick both Development and Production: the v0 preview only reads Development variables. Never name it NEXT_PUBLIC_TELMIAN_API_KEY, because NEXT_PUBLIC_ variables reach the browser.
Tell v0 exactly what to build
Build the sign-up screen first, then ask for the backend in a separate prompt. Name Telmian and the endpoints, or v0 may write Twilio-style code.
Create two Next.js route handlers, app/api/otp/send/route.ts and app/api/otp/verify/route.ts, that use Telmian's built-in OTP verification at https://app.telmian.com/v1 with header Authorization: Bearer ${process.env.TELMIAN_API_KEY}. The send handler calls POST /v1/verify with body {phone} and an Idempotency-Key header set to one attempt ID per sign-up attempt (reused on a retry). The verify handler calls POST /v1/verify/check with body {phone, code}, which returns {valid}. Server only: never call Telmian from a 'use client' component and never use NEXT_PUBLIC_. The client only posts the phone number, the attempt ID and the code. Ask me to add TELMIAN_API_KEY as an environment variable.Send the code from a route handler
This runs on the server, so the key never reaches the browser. The client sends one attempt ID per sign-up attempt and reuses it on a retry, so the same code request is never sent twice.
// app/api/otp/send/route.ts export async function POST(req: Request) { const { phone, attemptId } = await req.json(); const res = await fetch('https://app.telmian.com/v1/verify', { method: 'POST', headers: { Authorization: `Bearer ${process.env.TELMIAN_API_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': attemptId }, body: JSON.stringify({ phone }) }); return Response.json({ ok: res.ok }, { status: res.ok ? 200 : 502 }); }Check the code
Telmian answers with valid true or false. Only mark the user as verified on the server when valid is true.
// app/api/otp/verify/route.ts export async function POST(req: Request) { const { phone, code } = await req.json(); const check = await fetch('https://app.telmian.com/v1/verify/check', { method: 'POST', headers: { Authorization: `Bearer ${process.env.TELMIAN_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ phone, code }) }); const { valid } = await check.json(); return Response.json({ valid }); }Test in the v0 preview
Use +393000000001: it always receives code 000000. Use +393000000002 to see the failure path. Both are simulated and free.
Go live
Make your first paid top-up (from €5), create an sk_live_ key in the panel, set an approved business name, and put the live key in the Production variable. Then click Publish, or Publish Changes for later updates.
Questions
Can I call Telmian directly from a v0 React component?
No. Anything in a 'use client' component runs in the browser, so the key would be exposed. Keep the calls in a route handler or a Server Action and read process.env.TELMIAN_API_KEY there.
Why does my code work in production but fail in the v0 preview?
The v0 preview only reads environment variables enabled for Development. Open Settings > Environment Variables and tick Development for TELMIAN_API_KEY as well as Production.
Can my published v0 app use the Telmian MCP server?
No. In v0, MCP servers only give tools to v0 while it generates code. Your app must call the REST API or the npm package 'telmian' with TELMIAN_API_KEY. You can try adding https://app.telmian.com/mcp as a custom server (+ > MCPs, OAuth) so v0 can look things up while building, if the sign-in works there.
Where do I receive delivery reports and replies?
Ask v0 for a route handler such as app/api/telmian/webhook/route.ts, verify the signature, then publish. Point the webhook at your production domain: preview deployment URLs sit behind Vercel Deployment Protection, so outside requests do not reach them.
How much does it cost?
€0.05 per SMS segment to mobile numbers in 44 European countries, plus VAT. You prepay by card from €5, with no monthly fee or contract. SMS refused by the network or not delivered are refunded automatically.
Updated