Send a simple prompt
Pass a string ininput for a single-turn request.
The response includes generated text in output_text.
mka1 llm responses create \
--model auto \
--input '"Write a one-sentence summary of the MKA1 API."' \
-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.responses.create({
xOnBehalfOf: '<end-user-id>', // optional — attribute the request to one of your end users
responsesCreateRequest: {
model: 'auto',
input: 'Write a one-sentence summary of the MKA1 API.',
},
});
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: '<mka1-api-key>',
baseURL: 'https://apigw.mka1.com/api/v1/llm/',
defaultHeaders: { 'X-On-Behalf-Of': '<end-user-id>' },
});
const response = await openai.responses.create({
model: 'auto',
input: 'Write a one-sentence summary of the MKA1 API.',
stream: false,
});
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "Bearer YOUR_API_KEY");
var res = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
{
Model = "auto",
Input = ResponsesCreateRequestInput.CreateStr(
"Write a one-sentence summary of the MKA1 API."),
});
from meetkai_mka1 import SDK
sdk = SDK(bearer_auth="Bearer YOUR_API_KEY")
res = sdk.llm.responses.create(
model="auto",
input="Write a one-sentence summary of the MKA1 API.",
http_headers={"X-On-Behalf-Of": "<end-user-id>"},
)
curl https://apigw.mka1.com/api/v1/llm/responses \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"model": "auto",
"input": "Write a one-sentence summary of the MKA1 API."
}'
X-On-Behalf-Of.
Add instructions
Useinstructions to define behavior before the model sees the user input.
Keep instructions short and specific.
mka1 llm responses create \
--model auto \
--instructions 'You are a support assistant. Reply in plain English. Keep answers under 80 words.' \
--input '"Explain what embeddings are used for."'
const result = await mka1.llm.responses.create({
responsesCreateRequest: {
model: 'auto',
instructions: 'You are a support assistant. Reply in plain English. Keep answers under 80 words.',
input: 'Explain what embeddings are used for.',
},
});
const response = await openai.responses.create({
model: 'auto',
instructions: 'You are a support assistant. Reply in plain English. Keep answers under 80 words.',
input: 'Explain what embeddings are used for.',
stream: false,
});
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "Bearer YOUR_API_KEY");
var res = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
{
Model = "auto",
Instructions = "You are a support assistant. Reply in plain English. Keep answers under 80 words.",
Input = ResponsesCreateRequestInput.CreateStr("Explain what embeddings are used for."),
});
res = sdk.llm.responses.create(
model="auto",
instructions="You are a support assistant. Reply in plain English. Keep answers under 80 words.",
input="Explain what embeddings are used for.",
)
curl https://apigw.mka1.com/api/v1/llm/responses \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"model": "auto",
"instructions": "You are a support assistant. Reply in plain English. Keep answers under 80 words.",
"input": "Explain what embeddings are used for."
}'
Send structured messages
Use an array of message items ininput when you want explicit roles.
Each message item uses type, role, and content.
mka1 llm responses create --body '{
"model": "auto",
"input": [
{ "type": "message", "role": "developer", "content": "Answer as a technical writer. Keep the reply concise." },
{ "type": "message", "role": "user", "content": "Draft a short product update about faster response times." }
]
}'
const result = await mka1.llm.responses.create({
responsesCreateRequest: {
model: 'auto',
input: [
{ type: 'message', role: 'developer', content: 'Answer as a technical writer. Keep the reply concise.' },
{ type: 'message', role: 'user', content: 'Draft a short product update about faster response times.' },
],
},
});
const response = await openai.responses.create({
model: 'auto',
input: [
{ type: 'message', role: 'developer', content: 'Answer as a technical writer. Keep the reply concise.' },
{ type: 'message', role: 'user', content: 'Draft a short product update about faster response times.' },
],
stream: false,
});
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "Bearer YOUR_API_KEY");
var res = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
{
Model = "auto",
Input = ResponsesCreateRequestInput.CreateArrayOfItem(new List<Item>
{
Item.CreateInputMessage(new InputMessage()
{
Role = InputMessageRole.Developer,
Content = InputMessageContent1.CreateStr(
"Answer as a technical writer. Keep the reply concise."),
}),
Item.CreateInputMessage(new InputMessage()
{
Role = InputMessageRole.User,
Content = InputMessageContent1.CreateStr(
"Draft a short product update about faster response times."),
}),
}),
});
res = sdk.llm.responses.create(
model="auto",
input=[
{"type": "message", "role": "developer", "content": "Answer as a technical writer. Keep the reply concise."},
{"type": "message", "role": "user", "content": "Draft a short product update about faster response times."},
],
)
curl https://apigw.mka1.com/api/v1/llm/responses \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"model": "auto",
"input": [
{ "type": "message", "role": "developer", "content": "Answer as a technical writer. Keep the reply concise." },
{ "type": "message", "role": "user", "content": "Draft a short product update about faster response times." }
]
}'
Continue a multi-turn exchange
Useprevious_response_id to continue from an earlier response without resending the full history.
mka1 llm responses create \
--model auto \
--previous-response-id resp_123 \
--input '"Now turn that into an email subject line."'
const second = await mka1.llm.responses.create({
responsesCreateRequest: {
model: 'auto',
previousResponseId: 'resp_123',
input: 'Now turn that into an email subject line.',
},
});
const second = await openai.responses.create({
model: 'auto',
previous_response_id: 'resp_123',
input: 'Now turn that into an email subject line.',
stream: false,
});
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "Bearer YOUR_API_KEY");
// First request
var first = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
{
Model = "auto",
Input = ResponsesCreateRequestInput.CreateStr("Write a one-line product tagline."),
});
// Second request: continue from the first response
var second = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
{
Model = "auto",
PreviousResponseId = first.Id,
Input = ResponsesCreateRequestInput.CreateStr("Now turn that into an email subject line."),
});
res = sdk.llm.responses.create(
model="auto",
previous_response_id="resp_123",
input="Now turn that into an email subject line.",
)
curl https://apigw.mka1.com/api/v1/llm/responses \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"model": "auto",
"previous_response_id": "resp_123",
"input": "Now turn that into an email subject line."
}'
conversation.
# Create a conversation
mka1 llm conversations create --body '{
"metadata": { "session_id": "web-42" }
}'
# Use the conversation in a response request
mka1 llm responses create \
--model auto \
--conversation conv_123 \
--input '"What should I ask next to refine this draft?"'
const conv = await mka1.llm.conversations.create({
createConversationRequest: {
metadata: { session_id: 'web-42' },
},
});
const result = await mka1.llm.responses.create({
responsesCreateRequest: {
model: 'auto',
conversation: conv.id,
input: 'What should I ask next to refine this draft?',
},
});
const conv = await openai.conversations.create({
metadata: { session_id: 'web-42' },
});
const response = await openai.responses.create({
model: 'auto',
conversation: conv.id,
input: 'What should I ask next to refine this draft?',
stream: false,
});
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "Bearer YOUR_API_KEY");
var conv = await sdk.Llm.Conversations.CreateAsync(body: new CreateConversationRequest()
{
Metadata = new Dictionary<string, string> { { "session_id", "web-42" } },
});
conv = sdk.llm.conversations.create(
metadata={"session_id": "web-42"},
)
res = sdk.llm.responses.create(
model="auto",
conversation=conv.id,
input="What should I ask next to refine this draft?",
)
# Create conversation
curl https://apigw.mka1.com/api/v1/llm/conversations \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"metadata": { "session_id": "web-42" }
}'
# Use conversation in a response request
curl https://apigw.mka1.com/api/v1/llm/responses \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"model": "auto",
"conversation": "conv_123",
"input": "What should I ask next to refine this draft?"
}'
Stream text as it is generated
Setstream to true to receive server-sent events instead of waiting for the full response.
mka1 llm responses create \
--model auto \
--input '"Write three release notes bullets for our docs update."' \
--stream
import { CreateAcceptEnum } from '@meetkai/mka1/sdk/responses';
const result = await mka1.llm.responses.create({
responsesCreateRequest: {
model: 'auto',
input: 'Write three release notes bullets for our docs update.',
stream: true,
},
}, { acceptHeaderOverride: CreateAcceptEnum.textEventStream });
const stream = await openai.responses.create({
model: 'auto',
input: 'Write three release notes bullets for our docs update.',
stream: true,
});
for await (const event of stream) {
if (event.type === 'response.output_text.delta') {
process.stdout.write(event.delta);
}
}
using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "Bearer YOUR_API_KEY");
var res = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
{
Model = "auto",
Input = ResponsesCreateRequestInput.CreateStr(
"Write three release notes bullets for our docs update."),
Stream = true,
});
stream = sdk.llm.responses.create(
model="auto",
input="Write three release notes bullets for our docs update.",
stream=True,
)
for event in stream:
if event.data.type == "response.output_text.delta":
print(event.data.delta, end="", flush=True)
curl https://apigw.mka1.com/api/v1/llm/responses \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <mka1-api-key>' \
--header 'X-On-Behalf-Of: <end-user-id>' \
--data '{
"model": "auto",
"input": "Write three release notes bullets for our docs update.",
"stream": true
}'
Next steps
- Review the API overview for authentication and base URL details
- See background responses when you need to offload long-running work and poll or stream for results
- See manage conversations to organize multi-turn exchanges into reusable conversation containers
- See manage agents when you want reusable agent definitions and persisted runs