Skip to content

Prompt Management & Injection

Hardcoding system prompts inside your application is standard practice-until you need to update them or test different approaches. Vortik solves this with a centralized Prompt Hub where you can manage, version, and inject prompts dynamically, without deploying new code.

Centralized Prompt Hub

From the Prompt Hub, you can:

  • Create and edit: Write prompts using a clean editor that supports template variables.
  • Version control: Every change creates a new snapshot, making rollbacks instant.
  • Manage environments: Map specific prompt versions to your production, staging, or dev environments.

Dynamic Prompt Injection

Instead of passing the system prompt with every API call, you just send a v-prompt-id header to Vortik. The Gateway takes care of the rest-injecting the right prompt into your request before it ever reaches the AI provider.

How it Works

When Vortik receives a request with a v-prompt-id header, it:

  1. Looks up the prompt in your project.
  2. Grabs the requested version (or defaults to the latest active one).
  3. Prepends the prompt content as the first system message.
  4. Forwards the finalized payload to the AI provider.

Using Prompt Injection in your Code

To use a managed prompt, just pass the prompt ID in the v-prompt-id header:

javascript
import OpenAI from 'openai';

const openai = new OpenAI({
  apiKey: 'YOUR_VORTIK_API_KEY',
  baseURL: 'https://eu.gateway.vortik.ai/v1',
});

const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [
    { role: 'user', content: 'What do you think about the new feature?' }
  ],
}, {
  headers: {
    'v-prompt-id': 'prp_123abc456' // ID of your prompt in Vortik
  }
});
python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_VORTIK_API_KEY",
    base_url="https://eu.gateway.vortik.ai/v1"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "What do you think about the new feature?"}
    ],
    extra_headers={
        "v-prompt-id": "prp_123abc456" # ID of your prompt in Vortik
    }
)
csharp
using OpenAI.Chat;

ChatClient client = new(
    model: "gpt-4o",
    apiKey: "YOUR_VORTIK_API_KEY",
    options: new OpenAIClientOptions { 
        Endpoint = new Uri("https://eu.gateway.vortik.ai/v1") 
    }
);

ChatCompletion completion = client.CompleteChat(
    [new UserChatMessage("What do you think about the new feature?")],
    new ChatCompletionOptions { 
        AdditionalHttpHeaders = { ["v-prompt-id"] = "prp_123abc456" }
    }
);
php
$response = $client->chat()->create([
    'model' => 'gpt-4o',
    'messages' => [
        ['role' => 'user', 'content' => 'What do you think about the new feature?'],
    ],
], [
    'headers' => ['v-prompt-id' => 'prp_123abc456']
]);
bash
curl "https://eu.gateway.vortik.ai/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_VORTIK_API_KEY" \
  -H "v-prompt-id: prp_123abc456" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "What do you think about the new feature?"}
    ]
  }'

TIP

You don't need to include a system message in your messages array when using prompt injection. If you do, Vortik will prepand its managed prompt to your list of messages.


Learn how to monitor your AI requests with OpenTelemetry Ingestion.