Python (SDK)
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.inference.post_inference_api_key(data={
"type": latitudesh_python_sdk.CreateInferenceAPIKeyType.INFERENCE_API_KEYS,
"attributes": {
"project_id": "proj_AoW6vRnwkvLn0",
"name": "Production inference key",
},
})
# Handle response
print(res)curl --request POST \
--url https://api.latitude.sh/inference/api_keys \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "inference_api_keys",
"attributes": {
"project_id": "proj_AoW6vRnwkvLn0",
"name": "Production inference key"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'inference_api_keys',
attributes: {project_id: 'proj_AoW6vRnwkvLn0', name: 'Production inference key'}
}
})
};
fetch('https://api.latitude.sh/inference/api_keys', 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://api.latitude.sh/inference/api_keys",
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([
'data' => [
'type' => 'inference_api_keys',
'attributes' => [
'project_id' => 'proj_AoW6vRnwkvLn0',
'name' => 'Production inference key'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.latitude.sh/inference/api_keys"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"inference_api_keys\",\n \"attributes\": {\n \"project_id\": \"proj_AoW6vRnwkvLn0\",\n \"name\": \"Production inference key\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.latitude.sh/inference/api_keys")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"inference_api_keys\",\n \"attributes\": {\n \"project_id\": \"proj_AoW6vRnwkvLn0\",\n \"name\": \"Production inference key\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/inference/api_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"inference_api_keys\",\n \"attributes\": {\n \"project_id\": \"proj_AoW6vRnwkvLn0\",\n \"name\": \"Production inference key\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "aitok_6VE1Wd37dXnZJ",
"type": "inference_api_keys",
"attributes": {
"name": "Production inference key",
"token": "aitok_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8",
"token_last_slice": "e7f8",
"sync_status": "pending",
"last_used_at": null,
"created_at": "2026-01-14T15:56:29+00:00"
}
},
"meta": {}
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Inference
Create an inference API key
Creates an inference API key for the project. The full token is returned ONLY in this response — store it securely. All active keys for the project can authenticate at the inference control plane. Synchronization is asynchronous: sync_status confirms that the refresh receiver observed the key; it does not acknowledge every region.
POST
/
inference
/
api_keys
Python (SDK)
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.inference.post_inference_api_key(data={
"type": latitudesh_python_sdk.CreateInferenceAPIKeyType.INFERENCE_API_KEYS,
"attributes": {
"project_id": "proj_AoW6vRnwkvLn0",
"name": "Production inference key",
},
})
# Handle response
print(res)curl --request POST \
--url https://api.latitude.sh/inference/api_keys \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "inference_api_keys",
"attributes": {
"project_id": "proj_AoW6vRnwkvLn0",
"name": "Production inference key"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
type: 'inference_api_keys',
attributes: {project_id: 'proj_AoW6vRnwkvLn0', name: 'Production inference key'}
}
})
};
fetch('https://api.latitude.sh/inference/api_keys', 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://api.latitude.sh/inference/api_keys",
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([
'data' => [
'type' => 'inference_api_keys',
'attributes' => [
'project_id' => 'proj_AoW6vRnwkvLn0',
'name' => 'Production inference key'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.latitude.sh/inference/api_keys"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"inference_api_keys\",\n \"attributes\": {\n \"project_id\": \"proj_AoW6vRnwkvLn0\",\n \"name\": \"Production inference key\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://api.latitude.sh/inference/api_keys")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"inference_api_keys\",\n \"attributes\": {\n \"project_id\": \"proj_AoW6vRnwkvLn0\",\n \"name\": \"Production inference key\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/inference/api_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"type\": \"inference_api_keys\",\n \"attributes\": {\n \"project_id\": \"proj_AoW6vRnwkvLn0\",\n \"name\": \"Production inference key\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "aitok_6VE1Wd37dXnZJ",
"type": "inference_api_keys",
"attributes": {
"name": "Production inference key",
"token": "aitok_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8",
"token_last_slice": "e7f8",
"sync_status": "pending",
"last_used_at": null,
"created_at": "2026-01-14T15:56:29+00:00"
}
},
"meta": {}
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"status": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Was this page helpful?