Python (SDK)
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.compute_catalog.create_compute_quote(compute={
"accelerator": "<value>",
"ephemeral_disk_gb": 986693,
"gpu_count": 546670,
}, container={
"image": "https://loremflickr.com/3170/1872?lock=3147859139793822",
}, resource_type="job")
# 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.computeCatalog.createComputeQuote({
computeQuoteRequest: {
compute: {
accelerator: "<value>",
ephemeralDiskGb: 986693,
gpuCount: 546670,
},
container: {
image: "https://loremflickr.com/3170/1872?lock=3147859139793822",
},
resourceType: "job",
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.ComputeCatalog.CreateComputeQuoteAsync(body: new ComputeQuoteRequest() {
Compute = new ComputeRequest() {
Accelerator = "<value>",
EphemeralDiskGb = 986693,
GpuCount = 546670,
},
Container = new ComputeQuoteRequestContainer() {
Image = "https://loremflickr.com/3170/1872?lock=3147859139793822",
},
ResourceType = ComputeResourceType.Job,
});
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/compute/catalog/quotes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"compute": {
"accelerator": "<string>",
"ephemeral_disk_gb": 2,
"gpu_count": 4,
"interconnect": "<string>"
},
"container": {
"image": "<string>",
"ports": [
{
"container_port": 32768,
"name": "<string>"
}
]
},
"access": {
"ssh": true
},
"placement": {
"providers": [
"<string>"
]
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
compute: {
accelerator: '<string>',
ephemeral_disk_gb: 2,
gpu_count: 4,
interconnect: '<string>'
},
container: {image: '<string>', ports: [{container_port: 32768, name: '<string>'}]},
access: {ssh: true},
placement: {providers: ['<string>']}
})
};
fetch('https://apigw.mka1.com/api/v1/compute/catalog/quotes', 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/compute/catalog/quotes",
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([
'compute' => [
'accelerator' => '<string>',
'ephemeral_disk_gb' => 2,
'gpu_count' => 4,
'interconnect' => '<string>'
],
'container' => [
'image' => '<string>',
'ports' => [
[
'container_port' => 32768,
'name' => '<string>'
]
]
],
'access' => [
'ssh' => true
],
'placement' => [
'providers' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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/compute/catalog/quotes"
payload := strings.NewReader("{\n \"compute\": {\n \"accelerator\": \"<string>\",\n \"ephemeral_disk_gb\": 2,\n \"gpu_count\": 4,\n \"interconnect\": \"<string>\"\n },\n \"container\": {\n \"image\": \"<string>\",\n \"ports\": [\n {\n \"container_port\": 32768,\n \"name\": \"<string>\"\n }\n ]\n },\n \"access\": {\n \"ssh\": true\n },\n \"placement\": {\n \"providers\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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/compute/catalog/quotes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"compute\": {\n \"accelerator\": \"<string>\",\n \"ephemeral_disk_gb\": 2,\n \"gpu_count\": 4,\n \"interconnect\": \"<string>\"\n },\n \"container\": {\n \"image\": \"<string>\",\n \"ports\": [\n {\n \"container_port\": 32768,\n \"name\": \"<string>\"\n }\n ]\n },\n \"access\": {\n \"ssh\": true\n },\n \"placement\": {\n \"providers\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/compute/catalog/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"compute\": {\n \"accelerator\": \"<string>\",\n \"ephemeral_disk_gb\": 2,\n \"gpu_count\": 4,\n \"interconnect\": \"<string>\"\n },\n \"container\": {\n \"image\": \"<string>\",\n \"ports\": [\n {\n \"container_port\": 32768,\n \"name\": \"<string>\"\n }\n ]\n },\n \"access\": {\n \"ssh\": true\n },\n \"placement\": {\n \"providers\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"available": true,
"expires_at": "2023-11-07T05:31:56Z",
"observed_at": "2023-11-07T05:31:56Z",
"price_usd_hr": {
"max": 123,
"min": 123
},
"providers": [
{
"available": true,
"price_usd_hr": {
"max": 123,
"min": 123
},
"provider": "<string>"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}Compute Catalog
Criar uma cotação
POST
/
api
/
v1
/
compute
/
catalog
/
quotes
Python (SDK)
from meetkai_mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.compute_catalog.create_compute_quote(compute={
"accelerator": "<value>",
"ephemeral_disk_gb": 986693,
"gpu_count": 546670,
}, container={
"image": "https://loremflickr.com/3170/1872?lock=3147859139793822",
}, resource_type="job")
# 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.computeCatalog.createComputeQuote({
computeQuoteRequest: {
compute: {
accelerator: "<value>",
ephemeralDiskGb: 986693,
gpuCount: 546670,
},
container: {
image: "https://loremflickr.com/3170/1872?lock=3147859139793822",
},
resourceType: "job",
},
});
console.log(result);
}
run();using MeetKai.MKA1;
using MeetKai.MKA1.Types.Components;
var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.ComputeCatalog.CreateComputeQuoteAsync(body: new ComputeQuoteRequest() {
Compute = new ComputeRequest() {
Accelerator = "<value>",
EphemeralDiskGb = 986693,
GpuCount = 546670,
},
Container = new ComputeQuoteRequestContainer() {
Image = "https://loremflickr.com/3170/1872?lock=3147859139793822",
},
ResourceType = ComputeResourceType.Job,
});
// handle responsecurl --request POST \
--url https://apigw.mka1.com/api/v1/compute/catalog/quotes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"compute": {
"accelerator": "<string>",
"ephemeral_disk_gb": 2,
"gpu_count": 4,
"interconnect": "<string>"
},
"container": {
"image": "<string>",
"ports": [
{
"container_port": 32768,
"name": "<string>"
}
]
},
"access": {
"ssh": true
},
"placement": {
"providers": [
"<string>"
]
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
compute: {
accelerator: '<string>',
ephemeral_disk_gb: 2,
gpu_count: 4,
interconnect: '<string>'
},
container: {image: '<string>', ports: [{container_port: 32768, name: '<string>'}]},
access: {ssh: true},
placement: {providers: ['<string>']}
})
};
fetch('https://apigw.mka1.com/api/v1/compute/catalog/quotes', 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/compute/catalog/quotes",
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([
'compute' => [
'accelerator' => '<string>',
'ephemeral_disk_gb' => 2,
'gpu_count' => 4,
'interconnect' => '<string>'
],
'container' => [
'image' => '<string>',
'ports' => [
[
'container_port' => 32768,
'name' => '<string>'
]
]
],
'access' => [
'ssh' => true
],
'placement' => [
'providers' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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/compute/catalog/quotes"
payload := strings.NewReader("{\n \"compute\": {\n \"accelerator\": \"<string>\",\n \"ephemeral_disk_gb\": 2,\n \"gpu_count\": 4,\n \"interconnect\": \"<string>\"\n },\n \"container\": {\n \"image\": \"<string>\",\n \"ports\": [\n {\n \"container_port\": 32768,\n \"name\": \"<string>\"\n }\n ]\n },\n \"access\": {\n \"ssh\": true\n },\n \"placement\": {\n \"providers\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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/compute/catalog/quotes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"compute\": {\n \"accelerator\": \"<string>\",\n \"ephemeral_disk_gb\": 2,\n \"gpu_count\": 4,\n \"interconnect\": \"<string>\"\n },\n \"container\": {\n \"image\": \"<string>\",\n \"ports\": [\n {\n \"container_port\": 32768,\n \"name\": \"<string>\"\n }\n ]\n },\n \"access\": {\n \"ssh\": true\n },\n \"placement\": {\n \"providers\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigw.mka1.com/api/v1/compute/catalog/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"compute\": {\n \"accelerator\": \"<string>\",\n \"ephemeral_disk_gb\": 2,\n \"gpu_count\": 4,\n \"interconnect\": \"<string>\"\n },\n \"container\": {\n \"image\": \"<string>\",\n \"ports\": [\n {\n \"container_port\": 32768,\n \"name\": \"<string>\"\n }\n ]\n },\n \"access\": {\n \"ssh\": true\n },\n \"placement\": {\n \"providers\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"available": true,
"expires_at": "2023-11-07T05:31:56Z",
"observed_at": "2023-11-07T05:31:56Z",
"price_usd_hr": {
"max": 123,
"min": 123
},
"providers": [
{
"available": true,
"price_usd_hr": {
"max": 123,
"min": 123
},
"provider": "<string>"
}
]
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
}Autorizações
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>.
Cabeçalhos
Optional external end-user identifier forwarded by the API gateway.
Corpo
application/json
Esta página foi útil?
⌘I