Language Guide · Rust
Manage AI Prompts in Rust
No SDK required. One HTTP call.
Fetch versioned, variable-interpolated AI prompts from Rust using the reqwest crate. Strongly typed, async-native, and zero unnecessary overhead.
Code Example
One function. Any AI provider.
Fetch a versioned, interpolated prompt from PromptForge with a single HTTP call. The returned content string passes directly to your AI SDK — no transformation, no adapter, no extra library.
- 1Fetch a versioned prompt by ID with your variable values.
- 2Receive the fully rendered content string in the response.
- 3Pass it directly to your AI provider SDK as the system prompt.
use reqwest::header::AUTHORIZATION;
use serde::Deserialize;
#[derive(Deserialize)]
struct PromptResponse {
content: String,
}
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let prompt = reqwest::Client::new()
.get("https://www.promptforge-app.com/api/v1/prompts/YOUR_PROMPT_ID")
.query(&[
("_version", "latest"),
("role", "developer"),
("task", "review code"),
])
.header(AUTHORIZATION, "Bearer YOUR_API_KEY")
.send()
.await?
.json::<PromptResponse>()
.await?;
// Pass prompt.content to your AI provider client
println!("{}", prompt.content);
Ok(())
}Why Rust teams choose PromptForge
Designed for developers who want control without complexity.
Strongly typed response
Derive Deserialize on a one-field struct. Serde handles the JSON. If the API response shape ever changes, the compiler tells you immediately.
Async-native with Tokio
The reqwest pipeline composes naturally with Tokio async runtimes. No thread blocking, no channel gymnastics — just await and move on.
Zero-cost at the call site
The PromptForge fetch is one outbound HTTP request. Cache the result in a RwLock or DashMap to avoid repeated calls for the same prompt version.
Integrate in 4 steps
From zero to fetching your first versioned prompt in under 10 minutes. No framework setup, no SDK installation — just HTTP.
- 1
Create a prompt with variables
Open the dashboard, click New Prompt, and write your system prompt using {{variable}} placeholders for any dynamic values.
- 2
Copy your prompt ID
Your prompt ID appears in the URL bar when editing: /dashboard/prompts/YOUR_PROMPT_ID. The API Usage panel also shows it with pre-filled examples.
- 3
Generate an API key
Go to the API settings page and click Generate Key. Load it from environment variables using std::env::var or the dotenvy crate.
- 4
Fetch with reqwest
Add reqwest and serde with the derive feature to Cargo.toml. One await chain gives you a typed PromptResponse struct. Pass content to your AI provider client.
Teams building AI features in Rust
Rust teams building high-performance AI backends use PromptForge to keep prompts out of the compiled binary. Cache the response at startup and refresh it on a background timer — the AI prompt never requires a recompile.
Start Free TrialStart for free, upgrade anytime
No credit card required to get started. Paid plans include a 14-day free trial.
- 1 Production Prompt
- 1,000 API Requests/mo
- Stable/Latest Channel Routing
- No Credit Card Required
No charge until your trial ends
- 10k API requests/month
- 5 prompt
- Unlimited versions
- Dynamic variables
- Version pinning
- API key management
No charge until your trial ends
- 100k API requests/month
- 25 prompt
- Unlimited versions
- Dynamic variables
- Version pinning
- API key management
No charge until your trial ends
- 500k API requests/month
- 100 prompt
- Unlimited versions
- Dynamic variables
- Version pinning
- API key management
Questions? Contact us