Create a gateway
curl --request POST \
--url https://api.airctrl.dev/v1/gateways \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"defaultProviderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"defaultModel": "<string>",
"credentialIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"credentialBindings": [
{
"credentialId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modelId": "<string>"
}
]
}
'import requests
url = "https://api.airctrl.dev/v1/gateways"
payload = {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"defaultProviderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"defaultModel": "<string>",
"credentialIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"credentialBindings": [
{
"credentialId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modelId": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
slug: '<string>',
defaultProviderId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
defaultModel: '<string>',
credentialIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
credentialBindings: [{credentialId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', modelId: '<string>'}]
})
};
fetch('https://api.airctrl.dev/v1/gateways', 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.airctrl.dev/v1/gateways",
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([
'projectId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'slug' => '<string>',
'defaultProviderId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'defaultModel' => '<string>',
'credentialIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'credentialBindings' => [
[
'credentialId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'modelId' => '<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://api.airctrl.dev/v1/gateways"
payload := strings.NewReader("{\n \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"defaultProviderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"defaultModel\": \"<string>\",\n \"credentialIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"credentialBindings\": [\n {\n \"credentialId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modelId\": \"<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://api.airctrl.dev/v1/gateways")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"defaultProviderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"defaultModel\": \"<string>\",\n \"credentialIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"credentialBindings\": [\n {\n \"credentialId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modelId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.airctrl.dev/v1/gateways")
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 \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"defaultProviderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"defaultModel\": \"<string>\",\n \"credentialIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"credentialBindings\": [\n {\n \"credentialId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modelId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"gateway_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"name": "<string>",
"default_provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"default_model": "<string>",
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"settings": {
"spend_limit": "<string>",
"spend_window": "daily",
"rate_limit_per_min": 2,
"logging_enabled": true,
"log_bodies": true,
"guardrail_mode": "off",
"cache_enabled": true,
"cache_ttl_seconds": 61,
"allowed_models": [
"<string>"
]
},
"credential_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"credential_bindings": [
{
"credential_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"priority": 123
}
]
}
}{
"ok": false,
"error": {
"code": "bad_request",
"message": "Request validation failed",
"details": [
"Check the submitted values."
]
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "unauthorized",
"message": "Authentication is required"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "forbidden",
"message": "not_authorized"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "conflict",
"message": "idempotency_key_reused_with_different_params"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "rate_limited",
"message": "Too many requests"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "internal_error",
"message": "Internal server error"
},
"requestId": "req_example"
}Gateways
Create a gateway
Creates a gateway in a project. It may start without routing, or bind an existing provider credential to exactly one supported model verified against that credential’s live catalog. Requires gateways:create; adding a binding also requires the provider-credential permissions used by the credential endpoints.
POST
/
gateways
Create a gateway
curl --request POST \
--url https://api.airctrl.dev/v1/gateways \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"defaultProviderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"defaultModel": "<string>",
"credentialIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"credentialBindings": [
{
"credentialId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modelId": "<string>"
}
]
}
'import requests
url = "https://api.airctrl.dev/v1/gateways"
payload = {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"slug": "<string>",
"defaultProviderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"defaultModel": "<string>",
"credentialIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"credentialBindings": [
{
"credentialId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"modelId": "<string>"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
slug: '<string>',
defaultProviderId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
defaultModel: '<string>',
credentialIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
credentialBindings: [{credentialId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', modelId: '<string>'}]
})
};
fetch('https://api.airctrl.dev/v1/gateways', 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.airctrl.dev/v1/gateways",
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([
'projectId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'slug' => '<string>',
'defaultProviderId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'defaultModel' => '<string>',
'credentialIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'credentialBindings' => [
[
'credentialId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'modelId' => '<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://api.airctrl.dev/v1/gateways"
payload := strings.NewReader("{\n \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"defaultProviderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"defaultModel\": \"<string>\",\n \"credentialIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"credentialBindings\": [\n {\n \"credentialId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modelId\": \"<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://api.airctrl.dev/v1/gateways")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"defaultProviderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"defaultModel\": \"<string>\",\n \"credentialIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"credentialBindings\": [\n {\n \"credentialId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modelId\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.airctrl.dev/v1/gateways")
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 \"projectId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"defaultProviderId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"defaultModel\": \"<string>\",\n \"credentialIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"credentialBindings\": [\n {\n \"credentialId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"modelId\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"gateway_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"name": "<string>",
"default_provider_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"default_model": "<string>",
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"settings": {
"spend_limit": "<string>",
"spend_window": "daily",
"rate_limit_per_min": 2,
"logging_enabled": true,
"log_bodies": true,
"guardrail_mode": "off",
"cache_enabled": true,
"cache_ttl_seconds": 61,
"allowed_models": [
"<string>"
]
},
"credential_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"credential_bindings": [
{
"credential_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"priority": 123
}
]
}
}{
"ok": false,
"error": {
"code": "bad_request",
"message": "Request validation failed",
"details": [
"Check the submitted values."
]
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "unauthorized",
"message": "Authentication is required"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "forbidden",
"message": "not_authorized"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "conflict",
"message": "idempotency_key_reused_with_different_params"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "rate_limited",
"message": "Too many requests"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "internal_error",
"message": "Internal server error"
},
"requestId": "req_example"
}Authorizations
Human personal access token (sk-actrl-pat-...).
Body
application/json
Project that owns the gateway.
Gateway name.
Optional URL-safe gateway name.
Legacy shorthand: all credentials use defaultModel.
Show child attributes
Show child attributes