Quickstart
Fetch your first managed prompt in under five minutes. You need an API key and one of the SDKs.
Get an API key
Open Settings from the sidebar user menu and go to the API Keys tab to create one. Keys are prefixed sk_. Treat a key like a password — keep it on your server, never ship it to a browser bundle.
Install an SDK
Pick the SDK for your language:
pip install promptflipnpm install @promptflip/sdkFetch a prompt
Call get() with a prompt key and an inline fallback. The fallback is what your users see if the service is ever unreachable, so the call is always safe to make on the serving path.
from promptflip import PromptFlip
pm = PromptFlip(api_key="sk_...", environment="prod")
# Always returns a usable Prompt — never throws.
prompt = pm.get(
"welcome-message",
fallback="Welcome aboard, [[name]]!",
inputs={"name": user.name},
)
print(prompt.text)import { PromptFlip } from "@promptflip/sdk";
const pm = new PromptFlip({ apiKey: "sk_...", environment: "prod" });
// Always resolves to a usable Prompt — never rejects.
const prompt = await pm.get("welcome-message", "Welcome aboard, [[name]]!", {
inputs: { name: user.name },
});
console.log(prompt.text);Report results
Optional, but it powers version comparison and A/B experiments. Wrap your model call in run() and the SDK reports latency and whatever metrics you set:
with prompt.run() as r:
response = call_your_model(prompt.text)
# Set the telemetry you want to track:
r.tokens = response.total_tokens
r.converted = True # custom field — any name you choose is tracked as a metric
r.revenue_usd = 49 # another custom field
# latency is measured for you; on exit, everything you set is sent in one callawait prompt.run(async (r) => {
const response = await callYourModel(prompt.text);
// Set the telemetry you want to track:
r.tokens = response.totalTokens;
r.converted = true; // custom field — any name you choose is tracked as a metric
r.revenueUsd = 49; // another custom field
});
// latency is measured for you; on exit, everything you set is sent in one call