Skip to content

OpenAI-Compatible API ​

VeriPrompt exposes an OpenAI-compatible REST API so any OpenAI SDK, LangChain, Vercel AI, or plain curl works by changing two settings: baseURL and api_key.

How It Works

VeriPrompt acts as an AI gateway between your application and AI providers. Instead of calling OpenAI (or Anthropic, Google, etc.) directly, your app calls VeriPrompt using a VeriPrompt API key (sk-vp-...). VeriPrompt then routes the request to the best provider based on your routing policies, using the provider credentials you configured in the dashboard.

Your App  →  VeriPrompt Gateway  →  OpenAI / Anthropic / Google / ...
(sk-vp-...)   (routes & manages)      (your provider keys, configured in dashboard)

Before You Start ​

  1. Configure at least one AI provider in Settings > Provider Models with a valid provider API key.
  2. Create a VeriPrompt API key in Settings > External API Users — this gives you a sk-vp-... key.
  3. Use the sk-vp-... key as your api_key (not your raw OpenAI/Anthropic key).

Quick Start ​

Python ​

python
from openai import OpenAI

client = OpenAI(
    base_url="https://app.veriprompt.tech/api/v1",
    api_key="sk-vp-..."  # Your VeriPrompt API key
)

response = client.chat.completions.create(
    model="auto",  # Let VeriPrompt route to the best provider
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"}
    ],
    max_tokens=100
)

print(response.choices[0].message.content)

Node.js ​

typescript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://app.veriprompt.tech/api/v1',
  apiKey: 'sk-vp-...',
});

const completion = await client.chat.completions.create({
  model: 'auto',
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(completion.choices[0].message.content);

curl ​

bash
curl https://app.veriprompt.tech/api/v1/chat/completions \
  -H "Authorization: Bearer sk-vp-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 100
  }'

Endpoints ​

MethodPathDescription
POST/api/v1/chat/completionsCreate a chat completion
GET/api/v1/modelsList available models
GET/api/v1/models/{model_id}Get model details

Model Routing ​

VeriPrompt's key feature is intelligent model routing. Use these model ID formats:

FormatExampleBehavior
auto"auto"Route to best available provider
auto:fast"auto:fast"Prioritize speed
auto:quality"auto:quality"Prioritize quality
auto:cheap"auto:cheap"Prioritize cost
provider/model"openai/gpt-4o"Specific provider and model
alias/model"mycloud/llm-v2"Custom provider slug alias
policy:{id}"policy:abc123"Use a specific routing policy
group:{id}"group:def456"Use a provider group
Bare model"gpt-4o"Auto-detect provider from catalog

Provider Slug Aliases ​

Admins can create custom slug aliases in Settings > Provider Slugs to map prefixes to provider types. For example, creating alias mycloud -> OPENAI lets users send model: "mycloud/gpt-4o".

The resolution order is: company aliases > global aliases > built-in slugs.

Built-in slugs include: openai, anthropic, google, mistral, cohere, meta, deepseek, groq, perplexity, xai, azure, azure-openai, together, fireworks, replicate, ollama, lmstudio, openrouter.

Authentication ​

All requests require a VeriPrompt Bearer token (not a raw provider key):

Authorization: Bearer sk-vp-...

Common Mistake

Do not use your OpenAI key (sk-...), Anthropic key (sk-ant-...), or other provider keys here. Those keys are configured separately in Settings > Provider Models. The Authorization header must contain a VeriPrompt gateway key (sk-vp-... or legacy vp-gw_sk_...).

Create API keys in Settings > External API Users with type OPENAI_COMPAT to get keys with the sk-vp- prefix. Legacy vp-gw_sk_ keys also work.

Rate Limits ​

Rate limit headers are returned on every successful response:

HeaderDescription
x-ratelimit-remaining-requestsRemaining requests this month
x-ratelimit-remaining-tokensRemaining tokens this month
x-request-idUnique request identifier

VeriPrompt Extensions ​

Responses include a x_veriprompt object with routing metadata:

json
{
  "x_veriprompt": {
    "execution_id": "exec_...",
    "provider_type": "OPENAI",
    "provider_name": "OpenAI GPT-4o",
    "model_used": "gpt-4o",
    "response_time_ms": 1234
  }
}

Custom Headers ​

Control routing behavior with these optional request headers:

HeaderDescription
X-VeriPrompt-Policy-IdOverride routing policy
X-VeriPrompt-Session-IdSession affinity for provider consistency
X-VeriPrompt-QualityQuality hint (fast, quality, cheap)

Error Format ​

All errors follow the OpenAI error format:

json
{
  "error": {
    "message": "Human-readable description",
    "type": "authentication_error",
    "param": null,
    "code": "invalid_api_key"
  }
}
HTTP StatusError TypeCommon Codes
400invalid_request_errormissing_parameter, unsupported_parameter
401authentication_errorinvalid_api_key, key_expired, key_revoked
403server_errorbyok_required, ip_not_allowed
404not_found_errormodel_not_found
429rate_limit_errorrate_limit_exceeded
500server_errorinternal_error
502server_errorall_providers_failed

Troubleshooting ​

ErrorCauseFix
Invalid API key format. Expected prefix: sk-vp- or vp-gw_sk_Using a raw provider key (e.g., sk-... from OpenAI)Create a VeriPrompt key in Settings > External API Users
Model 'X' is not availableModel not configured for your companyImport the model in Settings > Provider Models, or use model: "auto"
No active AI providers availableNo providers configured or key decryption failureCheck Settings > Provider Models for active providers with valid API keys
BYOK_REQUIREDFree tier requires your own provider keysAdd at least one provider API key in Settings > Provider Models
Rate limit exceededMonthly quota exhaustedUpgrade your plan or wait for the monthly reset

Current Limitations (MVP) ​

  • No streaming — stream: true returns 400. Streaming support is planned.
  • No tool calling — Function/tool calling is not yet mapped.
  • No n > 1 — Multiple completions are not supported.
  • No logprobs — Always returns null.