from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.datasets.create_generation(idempotency_key="<value>", generator_id="<id>", params={
"key": "<value>",
"key1": "<value>",
}, output={
"repo": "<value>",
})
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.datasets.createGeneration({
idempotencyKey: "<value>",
createGeneration: {
generatorId: "<id>",
params: {
"key": "<value>",
"key1": "<value>",
},
output: {
repo: "<value>",
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Datasets.CreateGenerationAsync(
idempotencyKey: "<value>",
body: new CreateGeneration() {
GeneratorId = "<id>",
Params = new Dictionary<string, object>() {
{ "key", "<value>" },
{ "key1", "<value>" },
},
Output = new OutputSpec() {
Repo = "<value>",
},
}
);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/datasets/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"generator_id": "<string>",
"params": {},
"output": {
"repo": "<string>",
"revision": "main"
},
"inputs": {},
"limits": {
"max_runtime_hours": 1,
"max_cost": 123,
"max_llm_calls": 1
},
"name": "<string>",
"derived_from": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
generator_id: '<string>',
params: {},
output: {repo: '<string>', revision: 'main'},
inputs: {},
limits: {max_runtime_hours: 1, max_cost: 123, max_llm_calls: 1},
name: '<string>',
derived_from: ['<string>']
})
};
fetch('https://apigw.mka1.com/api/v1/datasets/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apigw.mka1.com/api/v1/datasets/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'generator_id' => '<string>',
'params' => [
],
'output' => [
'repo' => '<string>',
'revision' => 'main'
],
'inputs' => [
],
'limits' => [
'max_runtime_hours' => 1,
'max_cost' => 123,
'max_llm_calls' => 1
],
'name' => '<string>',
'derived_from' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/datasets/generations"
payload := strings.NewReader("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 123,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apigw.mka1.com/api/v1/datasets/generations")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 123,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/datasets/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 123,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"state": "pending",
"reason": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"generator": {
"id": "<string>",
"version": "<string>"
},
"params": {},
"params_hash": "<string>",
"output": {
"repo": "<string>",
"revision": "<string>",
"commit": "<string>"
},
"inputs": {},
"counts": {},
"llm": {
"models": [
"<string>"
]
},
"limits": {
"max_runtime_hours": 123,
"max_llm_calls": 1,
"max_cost": 123
},
"usage": {
"calls": 0,
"input_tokens": 0,
"output_tokens": 0,
"by_model": {}
},
"job": {
"name": "<string>",
"attempt": 123
},
"name": "<string>",
"derived_from": [
"<string>"
],
"created_by": {
"user_id": "<string>",
"team_id": "<string>",
"api_key_id": "<string>",
"delegation_id": "<string>",
"external_user_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"terminal_at": "2023-11-07T05:31:56Z",
"duplicate_of": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Generation
The components.md §6 D.1 sequence, in its order: the run credential is minted before anything is spent, nothing is written before the digest is pinned, and the workflow starts only after the row is committed.
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.datasets.create_generation(idempotency_key="<value>", generator_id="<id>", params={
"key": "<value>",
"key1": "<value>",
}, output={
"repo": "<value>",
})
# Handle response
print(res)import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.datasets.createGeneration({
idempotencyKey: "<value>",
createGeneration: {
generatorId: "<id>",
params: {
"key": "<value>",
"key1": "<value>",
},
output: {
repo: "<value>",
},
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
using System.Collections.Generic;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Datasets.CreateGenerationAsync(
idempotencyKey: "<value>",
body: new CreateGeneration() {
GeneratorId = "<id>",
Params = new Dictionary<string, object>() {
{ "key", "<value>" },
{ "key1", "<value>" },
},
Output = new OutputSpec() {
Repo = "<value>",
},
}
);
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/datasets/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"generator_id": "<string>",
"params": {},
"output": {
"repo": "<string>",
"revision": "main"
},
"inputs": {},
"limits": {
"max_runtime_hours": 1,
"max_cost": 123,
"max_llm_calls": 1
},
"name": "<string>",
"derived_from": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
generator_id: '<string>',
params: {},
output: {repo: '<string>', revision: 'main'},
inputs: {},
limits: {max_runtime_hours: 1, max_cost: 123, max_llm_calls: 1},
name: '<string>',
derived_from: ['<string>']
})
};
fetch('https://apigw.mka1.com/api/v1/datasets/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apigw.mka1.com/api/v1/datasets/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'generator_id' => '<string>',
'params' => [
],
'output' => [
'repo' => '<string>',
'revision' => 'main'
],
'inputs' => [
],
'limits' => [
'max_runtime_hours' => 1,
'max_cost' => 123,
'max_llm_calls' => 1
],
'name' => '<string>',
'derived_from' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apigw.mka1.com/api/v1/datasets/generations"
payload := strings.NewReader("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 123,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://apigw.mka1.com/api/v1/datasets/generations")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 123,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/datasets/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"generator_id\": \"<string>\",\n \"params\": {},\n \"output\": {\n \"repo\": \"<string>\",\n \"revision\": \"main\"\n },\n \"inputs\": {},\n \"limits\": {\n \"max_runtime_hours\": 1,\n \"max_cost\": 123,\n \"max_llm_calls\": 1\n },\n \"name\": \"<string>\",\n \"derived_from\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"state": "pending",
"reason": {
"code": "<string>",
"message": "<string>",
"details": {}
},
"generator": {
"id": "<string>",
"version": "<string>"
},
"params": {},
"params_hash": "<string>",
"output": {
"repo": "<string>",
"revision": "<string>",
"commit": "<string>"
},
"inputs": {},
"counts": {},
"llm": {
"models": [
"<string>"
]
},
"limits": {
"max_runtime_hours": 123,
"max_llm_calls": 1,
"max_cost": 123
},
"usage": {
"calls": 0,
"input_tokens": 0,
"output_tokens": 0,
"by_model": {}
},
"job": {
"name": "<string>",
"attempt": 123
},
"name": "<string>",
"derived_from": [
"<string>"
],
"created_by": {
"user_id": "<string>",
"team_id": "<string>",
"api_key_id": "<string>",
"delegation_id": "<string>",
"external_user_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"terminal_at": "2023-11-07T05:31:56Z",
"duplicate_of": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
Headers
1 - 255Optional external end-user identifier forwarded by the API gateway.
Body
1 - 64Show child attributes
Show child attributes
Show child attributes
Show child attributes
Each value may only be lower than the generator's default (api.md §3).
Show child attributes
Show child attributes
200100Response
Successful Response
pending, running, publishing, succeeded, failed, cancelling, cancelled api.md §3 reason.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
api.md §2 limits / default_limits on the wire: B.1's contract.Limits, with
max_cost optional and deprecated in the schema while every response still carries it as a
number (MK1-722, step 1 of MK1-719). The two must otherwise agree field for field.
Show child attributes
Show child attributes
api.md §3 usage, the shape of the runtime's llm.Usage.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?