{{variable}} placeholders that are rendered server-side when you
retrieve a prompt, so you can reuse the same template across different contexts.
Create a prompt
Create a prompt with a name and template. The first version is created automatically.mka1 llm prompts create \
--body '{
"name": "greeting",
"description": "A simple greeting template",
"template": "Hello, {{name}}! Welcome to {{company}}.",
"metadata": { "team": "onboarding" }
}' \
-H 'X-On-Behalf-Of: <end-user-id>'
import { SDK } from '@meetkai/mka1';
const mka1 = new SDK({
bearerAuth: `Bearer ${YOUR_API_KEY}`,
});
const result = await mka1.llm.prompts.create({
xOnBehalfOf: '<end-user-id>', // optional — attribute the request to one of your end users
requestBody: {
name: 'greeting',
description: 'A simple greeting template',
template: 'Hello, {{name}}! Welcome to {{company}}.',
metadata: { team: 'onboarding' },
},
});
console.log(result.id); // prompt_abc123...
console.log(result.activeVersion); // 1
console.log(result.version?.version); // 1
const promptId = result.id; // used in the examples below
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var result = await sdk.Llm.Prompts.CreateAsync(
new CreatePromptRequest
{
Name = "greeting",
Description = "A simple greeting template",
Template = "Hello, {{name}}! Welcome to {{company}}.",
Metadata = new Dictionary<string, object> { { "team", "onboarding" } },
}
);
Console.WriteLine(result.CreatePromptResponseValue!.Id); // prompt_abc123...
Console.WriteLine(result.CreatePromptResponseValue!.ActiveVersion); // 1
Console.WriteLine(result.CreatePromptResponseValue!.Version!.Version); // 1
from meetkai_mka1 import SDK
sdk = SDK(bearer_auth="Bearer YOUR_API_KEY")
result = sdk.llm.prompts.create(
name="greeting",
description="A simple greeting template",
template="Hello, {{name}}! Welcome to {{company}}.",
metadata={"team": "onboarding"},
)
print(result.id) # prompt_abc123...
print(result.active_version) # 1
print(result.version.version) # 1
curl https://apigw.mka1.com/api/v1/llm/prompts \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"name": "greeting",
"description": "A simple greeting template",
"template": "Hello, {{name}}! Welcome to {{company}}.",
"metadata": { "team": "onboarding" }
}'
Retrieve a prompt with rendered variables
Passvariables as a query parameter to render the template with your values.
Unmatched placeholders are left as-is.
Optionally, pass version to retrieve (and render) a specific version. If omitted,
the active version is returned.
The response always includes
active_template (activeTemplate in the TypeScript SDK) — the raw
template text of the requested version, with {{placeholders}} intact. When you pass variables,
the response also includes rendered_template (renderedTemplate) with the substituted result;
it is absent when no variables are provided.mka1 llm prompts get \
--id prompt_abc123 \
--variables '{"name":"Alice","company":"Acme"}'
const prompt = await mka1.llm.prompts.get({
xOnBehalfOf: '<end-user-id>',
id: promptId,
variables: JSON.stringify({ name: 'Alice', company: 'Acme' }),
});
console.log(prompt.renderedTemplate);
// "Hello, Alice! Welcome to Acme."
using MeetKai.MKA1;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var prompt = await sdk.Llm.Prompts.GetAsync(
id: promptId,
variables: "{\"name\":\"Alice\",\"company\":\"Acme\"}"
);
Console.WriteLine(prompt.GetPromptResponseValue!.RenderedTemplate);
// "Hello, Alice! Welcome to Acme."
prompt = sdk.llm.prompts.get(
id=prompt_id,
variables='{"name": "Alice", "company": "Acme"}',
)
print(prompt.rendered_template)
# "Hello, Alice! Welcome to Acme."
# URL-encode the variables JSON
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123?variables=%7B%22name%22%3A%22Alice%22%2C%22company%22%3A%22Acme%22%7D" \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>'
List prompts
Retrieve a paginated list of all prompts. Useafter for cursor-based pagination.
mka1 llm prompts list --limit 10 --order desc
const list = await mka1.llm.prompts.list({
xOnBehalfOf: '<end-user-id>',
limit: 10,
order: 'desc',
});
for (const prompt of list.data) {
console.log(prompt.name, `v${prompt.activeVersion}`);
}
if (list.hasMore) {
// Fetch next page using the last ID as cursor
const next = await mka1.llm.prompts.list({
xOnBehalfOf: '<end-user-id>',
limit: 10,
after: list.lastId,
});
}
using MeetKai.MKA1;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var prompts = await sdk.Llm.Prompts.ListAsync();
Console.WriteLine(prompts);
prompts = sdk.llm.prompts.list()
for prompt in prompts.data:
print(prompt.name, f"v{prompt.active_version}")
curl "https://apigw.mka1.com/api/v1/llm/prompts?limit=10&order=desc" \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>'
Update prompt metadata
Update the name, description, or metadata of a prompt. To change the template, create a new version instead. Note:metadata replaces the existing metadata object (it is not merged). To clear a description, pass null.
mka1 llm prompts update \
--id prompt_abc123 \
--body '{
"name": "welcome-greeting",
"description": "Updated greeting for the welcome flow",
"metadata": { "team": "onboarding", "reviewed": true }
}'
const updated = await mka1.llm.prompts.update({
xOnBehalfOf: '<end-user-id>',
id: promptId,
requestBody: {
name: 'welcome-greeting',
description: 'Updated greeting for the welcome flow',
metadata: { team: 'onboarding', reviewed: true },
},
});
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Requests;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var updated = await sdk.Llm.Prompts.UpdateAsync(
id: promptId,
body: new UpdatePromptRequestBody
{
Name = "welcome-greeting",
Description = "Updated greeting for the welcome flow",
Metadata = new Dictionary<string, object>
{
{ "team", "onboarding" },
{ "reviewed", true },
},
}
);
updated = sdk.llm.prompts.update(
id=prompt_id,
name="welcome-greeting",
description="Updated greeting for the welcome flow",
metadata={"team": "onboarding", "reviewed": True},
)
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123" \
--request PUT \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"name": "welcome-greeting",
"description": "Updated greeting for the welcome flow",
"metadata": { "team": "onboarding", "reviewed": true }
}'
Create a new version
Each template change creates a new version. The new version automatically becomes the active version.mka1 llm prompts create-version \
--id prompt_abc123 \
--body '{
"template": "Hi {{name}}! Welcome aboard at {{company}}. Your onboarding starts {{date}}."
}'
const version = await mka1.llm.prompts.createVersion({
xOnBehalfOf: '<end-user-id>',
id: promptId,
requestBody: {
template: 'Hi {{name}}! Welcome aboard at {{company}}. Your onboarding starts {{date}}.',
},
});
console.log(version.version); // 2
console.log(version.template); // The new template text
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Requests;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var version = await sdk.Llm.Prompts.CreateVersionAsync(
id: promptId,
body: new CreatePromptVersionRequestBody
{
Template = "Hi {{name}}! Welcome aboard at {{company}}. Your onboarding starts {{date}}.",
}
);
Console.WriteLine(version.CreateVersionResponse!.Version); // 2
Console.WriteLine(version.CreateVersionResponse!.Template); // The new template text
version = sdk.llm.prompts.create_version(
id=prompt_id,
template="Hi {{name}}! Welcome aboard at {{company}}. Your onboarding starts {{date}}.",
)
print(version.version) # 2
print(version.template) # The new template text
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123/versions" \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"template": "Hi {{name}}! Welcome aboard at {{company}}. Your onboarding starts {{date}}."
}'
View version history
List all versions of a prompt to see its full change history.mka1 llm prompts list-versions --id prompt_abc123 --order desc
const versions = await mka1.llm.prompts.listVersions({
xOnBehalfOf: '<end-user-id>',
id: promptId,
order: 'desc',
});
for (const v of versions.data) {
console.log(`v${v.version}: ${v.template.slice(0, 50)}...`);
}
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Requests;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var versions = await sdk.Llm.Prompts.ListVersionsAsync(
id: promptId,
order: ListPromptVersionsOrder.Desc
);
foreach (var v in versions.ListVersionsResponse!.Data)
{
Console.WriteLine($"v{v.Version}: {v.Template.Substring(0, 50)}...");
}
versions = sdk.llm.prompts.list_versions(id=prompt_id)
for v in versions.data:
print(f"v{v.version}: {v.template[:50]}...")
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123/versions?order=desc" \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>'
Retrieve a specific version
Fetch a single version by its version number.mka1 llm prompts get-version --id prompt_abc123 --version-param 1
const v1 = await mka1.llm.prompts.getVersion({
xOnBehalfOf: '<end-user-id>',
id: promptId,
version: 1,
});
console.log(v1.template);
using MeetKai.MKA1;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var v1 = await sdk.Llm.Prompts.GetVersionAsync(
id: promptId,
version: 1
);
Console.WriteLine(v1.CreateVersionResponse!.Template);
v1 = sdk.llm.prompts.get_version(id=prompt_id, version=1)
print(v1.template)
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123/versions/1" \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>'
Roll back to a previous version
Rollback sets an earlier version as the active version. All versions are preserved — rollback does not delete newer versions, so you can always roll forward again.# Currently on version 2, roll back to version 1
mka1 llm prompts rollback --id prompt_abc123 --version-param 1
// Currently on version 2, roll back to version 1
const rolledBack = await mka1.llm.prompts.rollback({
xOnBehalfOf: '<end-user-id>',
id: promptId,
requestBody: {
version: 1,
},
});
console.log(rolledBack.activeVersion); // 1
console.log(rolledBack.latestVersion); // 2 (still exists)
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Requests;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
// Currently on version 2, roll back to version 1
var rolledBack = await sdk.Llm.Prompts.RollbackAsync(
id: promptId,
body: new RollbackPromptRequestBody { Version = 1 }
);
Console.WriteLine(rolledBack.UpdatePromptResponse!.ActiveVersion); // 1
Console.WriteLine(rolledBack.UpdatePromptResponse!.LatestVersion); // 2 (still exists)
# Currently on version 2, roll back to version 1
rolled_back = sdk.llm.prompts.rollback(id=prompt_id, version=1)
print(rolled_back.active_version) # 1
print(rolled_back.latest_version) # 2 (still exists)
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123/rollback" \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{ "version": 1 }'
Delete a prompt
Deleting a prompt removes it and all of its versions permanently.mka1 llm prompts delete --id prompt_abc123
const deleted = await mka1.llm.prompts.delete({
xOnBehalfOf: '<end-user-id>',
id: promptId,
});
console.log(deleted.deleted); // true
using MeetKai.MKA1;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
var deleted = await sdk.Llm.Prompts.DeleteAsync(id: promptId);
Console.WriteLine(deleted.DeletePromptResponseValue!.Deleted); // True
deleted = sdk.llm.prompts.delete(id=prompt_id)
print(deleted.deleted) # True
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123" \
--request DELETE \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>'
Full example: versioning and rollback workflow
This example demonstrates the complete lifecycle — creating a prompt, iterating on the template, reviewing history, and rolling back.# 1. Create a prompt with the initial template
mka1 llm prompts create \
--body '{
"name": "support-reply",
"template": "Hi {{customer}}, thanks for contacting us about {{issue}}."
}'
# → { "id": "prompt_abc123", "active_version": 1, "version": { "version": 1, ... }, ... }
# 2. Ship v2 with a friendlier tone
mka1 llm prompts create-version \
--id prompt_abc123 \
--body '{
"template": "Hey {{customer}}! We got your message about {{issue}} and are on it."
}'
# 3. Retrieve the prompt with rendered variables
mka1 llm prompts get \
--id prompt_abc123 \
--variables '{"customer":"Alice","issue":"billing"}'
# 4. Review version history
mka1 llm prompts list-versions --id prompt_abc123 --order asc
# 5. Roll back to v1
mka1 llm prompts rollback --id prompt_abc123 --version-param 1
# 6. Clean up
mka1 llm prompts delete --id prompt_abc123
import { SDK } from '@meetkai/mka1';
const mka1 = new SDK({
bearerAuth: `Bearer ${YOUR_API_KEY}`,
});
// 1. Create a prompt with the initial template
const prompt = await mka1.llm.prompts.create({
xOnBehalfOf: 'user-123',
requestBody: {
name: 'support-reply',
template: 'Hi {{customer}}, thanks for contacting us about {{issue}}.',
},
});
console.log('Created:', prompt.id, 'v1');
// 2. Ship v2 with a friendlier tone
const v2 = await mka1.llm.prompts.createVersion({
xOnBehalfOf: 'user-123',
id: prompt.id,
requestBody: {
template: 'Hey {{customer}}! We got your message about {{issue}} and are on it.',
},
});
console.log('Created v2:', v2.version);
// 3. Retrieve the prompt — active version is now v2
const current = await mka1.llm.prompts.get({
xOnBehalfOf: 'user-123',
id: prompt.id,
variables: JSON.stringify({ customer: 'Alice', issue: 'billing' }),
});
console.log('Active:', current.renderedTemplate);
// "Hey Alice! We got your message about billing and are on it."
// 4. Review version history
const history = await mka1.llm.prompts.listVersions({
xOnBehalfOf: 'user-123',
id: prompt.id,
order: 'asc',
});
for (const v of history.data) {
console.log(` v${v.version}: ${v.template}`);
}
// 5. Roll back to v1
const rolledBack = await mka1.llm.prompts.rollback({
xOnBehalfOf: 'user-123',
id: prompt.id,
requestBody: {
version: 1,
},
});
console.log('Rolled back to v' + rolledBack.activeVersion);
// activeVersion=1, latestVersion=2
// 6. Clean up
await mka1.llm.prompts.delete({ xOnBehalfOf: 'user-123', id: prompt.id });
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using MeetKai.MKA1.Types.Requests;
var sdk = new SDK(
bearerAuth: "Bearer <mka1-api-key>",
serverUrl: "https://apigw.mka1.com"
);
// 1. Create a prompt with the initial template
var prompt = await sdk.Llm.Prompts.CreateAsync(
new CreatePromptRequest
{
Name = "support-reply",
Template = "Hi {{customer}}, thanks for contacting us about {{issue}}.",
}
);
var promptId = prompt.CreatePromptResponseValue!.Id;
Console.WriteLine($"Created: {promptId} v1");
// 2. Ship v2 with a friendlier tone
var v2 = await sdk.Llm.Prompts.CreateVersionAsync(
id: promptId,
body: new CreatePromptVersionRequestBody
{
Template = "Hey {{customer}}! We got your message about {{issue}} and are on it.",
}
);
Console.WriteLine($"Created v2: {v2.CreateVersionResponse!.Version}");
// 3. Retrieve the prompt with rendered variables
var current = await sdk.Llm.Prompts.GetAsync(
id: promptId,
variables: "{\"customer\":\"Alice\",\"issue\":\"billing\"}"
);
Console.WriteLine($"Active: {current.GetPromptResponseValue!.RenderedTemplate}");
// 4. Review version history
var history = await sdk.Llm.Prompts.ListVersionsAsync(
id: promptId,
order: ListPromptVersionsOrder.Asc
);
foreach (var v in history.ListVersionsResponse!.Data)
{
Console.WriteLine($" v{v.Version}: {v.Template}");
}
// 5. Roll back to v1
var rolledBack = await sdk.Llm.Prompts.RollbackAsync(
id: promptId,
body: new RollbackPromptRequestBody { Version = 1 }
);
Console.WriteLine($"Rolled back to v{rolledBack.UpdatePromptResponse!.ActiveVersion}");
// 6. Clean up
await sdk.Llm.Prompts.DeleteAsync(id: promptId);
from meetkai_mka1 import SDK
sdk = SDK(bearer_auth="Bearer YOUR_API_KEY")
# 1. Create a prompt with the initial template
prompt = sdk.llm.prompts.create(
name="support-reply",
template="Hi {{customer}}, thanks for contacting us about {{issue}}.",
)
print("Created:", prompt.id, "v1")
# 2. Ship v2 with a friendlier tone
v2 = sdk.llm.prompts.create_version(
id=prompt.id,
template="Hey {{customer}}! We got your message about {{issue}} and are on it.",
)
print("Created v2:", v2.version)
# 3. Retrieve the prompt — active version is now v2
current = sdk.llm.prompts.get(
id=prompt.id,
variables='{"customer": "Alice", "issue": "billing"}',
)
print("Active:", current.rendered_template)
# "Hey Alice! We got your message about billing and are on it."
# 4. Review version history
history = sdk.llm.prompts.list_versions(id=prompt.id)
for v in history.data:
print(f" v{v.version}: {v.template}")
# 5. Roll back to v1
rolled_back = sdk.llm.prompts.rollback(id=prompt.id, version=1)
print("Rolled back to v" + str(rolled_back.active_version))
# active_version=1, latest_version=2
# 6. Clean up
sdk.llm.prompts.delete(id=prompt.id)
# 1. Create a prompt
curl https://apigw.mka1.com/api/v1/llm/prompts \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: user-123' \
--data '{
"name": "support-reply",
"template": "Hi {{customer}}, thanks for contacting us about {{issue}}."
}'
# → { "id": "prompt_abc123", "active_version": 1, "version": { "version": 1, ... }, ... }
# 2. Create v2 with a friendlier tone
curl https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123/versions \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: user-123' \
--data '{
"template": "Hey {{customer}}! We got your message about {{issue}} and are on it."
}'
# 3. Get the prompt with rendered variables
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123?variables=%7B%22customer%22%3A%22Alice%22%2C%22issue%22%3A%22billing%22%7D" \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: user-123'
# 4. View version history
curl "https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123/versions?order=asc" \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: user-123'
# 5. Roll back to v1
curl https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123/rollback \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: user-123' \
--data '{ "version": 1 }'
# 6. Delete the prompt
curl https://apigw.mka1.com/api/v1/llm/prompts/prompt_abc123 \
--request DELETE \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: user-123'
Behavior details
| Aspect | Detail |
|---|---|
| Versioning | Immutable — each template change creates a new version that cannot be modified |
| Active version | New versions auto-activate; use rollback to switch to a different version |
| Rollback | Non-destructive — sets active_version without deleting newer versions |
| Pagination | Cursor-based for listing prompts — use after parameter with last_id from response |
| Template rendering | Server-side — pass variables query parameter; unmatched placeholders preserved |
| Ownership | Per API key — prompts are isolated by authentication context |
| Concurrency | Conflict detection — concurrent version creation returns 409 |
Next steps
- Generate a response — use rendered prompts as input to the Responses API
- Extract structured data — combine prompts with structured extraction
- Conversations — manage multi-turn exchanges with versioned system prompts