Appearance
Quick Start Guide
Get up and running with Veriprompt in 5 minutes. This guide will walk you through making your first API call and seeing Veriprompt in action.
Step 1: Get Your API Key
Option A: Using Our Cloud Service
- Sign up at veriprompt.com
- Navigate to Developer Portal in your dashboard
- Click "Generate API Key"
- Copy your API key (starts with
vp_)
Option B: Self-Hosted
If you're running Veriprompt on your own infrastructure:
- Log in to your Veriprompt instance
- Navigate to Settings → API Keys
- Generate a new API key
- Copy and store it securely
Keep Your API Key Secret
Never commit API keys to version control or share them publicly. Store them as environment variables.
Step 2: Make Your First API Call
Choose your preferred language:
bash
curl -X POST https://app.veriprompt.tech/api/gateway/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "Explain quantum computing in simple terms",
"provider": "auto",
"maxTokens": 150
}'javascript
// Install: npm install @veriprompt/sdk
import { VeripromptClient } from '@veriprompt/sdk';
const client = new VeripromptClient({
apiKey: process.env.VERIPROMPT_API_KEY
});
async function runPrompt() {
const response = await client.execute({
prompt: 'Explain quantum computing in simple terms',
provider: 'auto', // Let Veriprompt choose the best provider
maxTokens: 150
});
console.log(response.text);
console.log(`Used provider: ${response.provider}`);
console.log(`Cost: $${response.cost}`);
}
runPrompt();python
# Install: pip install veriprompt
from veriprompt import VeripromptClient
client = VeripromptClient(api_key="YOUR_API_KEY")
response = client.execute(
prompt="Explain quantum computing in simple terms",
provider="auto", # Let Veriprompt choose the best provider
max_tokens=150
)
print(response.text)
print(f"Used provider: {response.provider}")
print(f"Cost: ${response.cost}")Pro Tip
Use provider: "auto" to let Veriprompt's intelligent routing choose the optimal provider based on cost, performance, and quality!
Step 3: Understand the Response
You'll receive a response like this:
json
{
"text": "Quantum computing harnesses quantum mechanics to process information in fundamentally new ways...",
"provider": "anthropic",
"model": "claude-3-sonnet",
"tokens": {
"prompt": 8,
"completion": 142,
"total": 150
},
"cost": 0.0012,
"latency": 1234,
"requestId": "req_abc123xyz",
"timestamp": "2024-11-10T10:30:00Z"
}Key Response Fields
| Field | Description |
|---|---|
text | The AI-generated response |
provider | Which AI provider was used (e.g., anthropic, openai) |
model | The specific model used |
tokens | Token usage breakdown |
cost | Actual cost in USD for this request |
latency | Response time in milliseconds |
requestId | Unique ID for tracking and debugging |
Step 4: Add Security Scanning
Protect against prompt injection attacks with built-in security:
javascript
const response = await client.execute({
prompt: userInput, // User-provided input
provider: 'auto',
security: {
scanInjection: true, // Detect injection attempts
blockOnThreat: true, // Block if threats detected
minThreatScore: 0.7 // Threat threshold (0-1)
}
});
if (response.security.threatsDetected) {
console.error('Security threat detected:', response.security.threats);
// Handle the threat appropriately
} else {
console.log(response.text);
}python
response = client.execute(
prompt=user_input, # User-provided input
provider="auto",
security={
"scan_injection": True, # Detect injection attempts
"block_on_threat": True, # Block if threats detected
"min_threat_score": 0.7 # Threat threshold (0-1)
}
)
if response.security.threats_detected:
print("Security threat detected:", response.security.threats)
# Handle the threat appropriately
else:
print(response.text)bash
curl -X POST https://app.veriprompt.tech/api/gateway/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "User input here",
"provider": "auto",
"security": {
"scanInjection": true,
"blockOnThreat": true,
"minThreatScore": 0.7
}
}'Step 5: Optimize for Cost
Route to the most cost-effective provider:
javascript
const response = await client.execute({
prompt: 'Summarize this article...',
routing: {
strategy: 'cost-optimized', // Prioritize lowest cost
maxCost: 0.001, // Max cost per request
minQuality: 80 // Minimum quality score (0-100)
}
});
console.log(`Saved money! Used ${response.provider} at $${response.cost}`);python
response = client.execute(
prompt="Summarize this article...",
routing={
"strategy": "cost-optimized", # Prioritize lowest cost
"max_cost": 0.001, # Max cost per request
"min_quality": 80 # Minimum quality score (0-100)
}
)
print(f"Saved money! Used {response.provider} at ${response.cost}")Result: Veriprompt automatically routes to providers like DeepSeek or smaller models when appropriate, saving you money without sacrificing quality.
Step 6: Use Stored Prompts
Store prompts in the repository for versioning and reuse:
Create a Prompt in the UI
- Navigate to Prompt Repository
- Click "New Prompt"
- Enter prompt details:
- ID:
welcome-message - System Prompt:
You are a friendly customer service assistant - User Prompt:
Greet the customer and ask how you can help
- ID:
- Click Save
Execute the Stored Prompt
javascript
const response = await client.executePrompt({
promptId: 'welcome-message',
variables: {
customerName: 'John'
}
});python
response = client.execute_prompt(
prompt_id="welcome-message",
variables={
"customer_name": "John"
}
)bash
curl -X POST https://app.veriprompt.tech/api/gateway/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"promptId": "welcome-message",
"variables": {
"customerName": "John"
}
}'Common Use Cases
1. Customer Support Chatbot
javascript
async function handleCustomerQuery(userMessage, conversationHistory) {
const response = await client.execute({
prompt: userMessage,
context: conversationHistory,
routing: {
strategy: 'balanced', // Balance cost and quality
maxLatency: 2000 // Max 2 second response
},
security: {
scanInjection: true // Protect against prompt injection
}
});
return response.text;
}2. Content Generation
javascript
async function generateBlogPost(topic, tone) {
const response = await client.execute({
prompt: `Write a blog post about ${topic} in a ${tone} tone`,
routing: {
strategy: 'quality-first', // Prioritize quality
minQuality: 90
},
maxTokens: 1000
});
return response.text;
}3. Data Analysis
javascript
async function analyzeData(csvData) {
const response = await client.execute({
prompt: `Analyze this data and provide insights: ${csvData}`,
provider: 'claude-3-opus', // Use specific high-capability model
attachments: [{
type: 'text/csv',
content: csvData
}]
});
return response.text;
}Next Steps
Troubleshooting
"Unauthorized" Error
Make sure your API key is:
- Valid and not expired
- Included in the
Authorization: Bearerheader - Not accidentally shared or committed to GitHub
"Rate Limited" Error
You've exceeded your tier's rate limit. Solutions:
- Implement exponential backoff
- Upgrade your tier
- Use caching for repeated requests
"Provider Unavailable" Error
The selected provider is temporarily down. Solutions:
- Use
provider: "auto"for automatic failover - Configure fallback providers in routing policy
- Check status.veriprompt.com
View Complete Troubleshooting Guide →
Get Help
- 📚 Full API Documentation
- ❓ FAQ
- 💬 Community Forum
- 📧 support@veriprompt.com
Congratulations! 🎉 You've made your first API call with Veriprompt. Ready to build something amazing?
