curl https://api.naga.ac/v1/account/keys \
-H "Authorization: Bearer $NAGA_PROVISIONING_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "production",
"credit_limit": 25.0,
"expires_at": "2027-01-01T00:00:00Z"
}'import requests
url = "https://api.naga.ac/v1/account/keys"
payload = { "name": "production" }
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({name: 'production'})
};
fetch('https://api.naga.ac/v1/account/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.naga.ac/v1/account/keys"
payload := strings.NewReader("{\n \"name\": \"production\"\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))
}{
"id": 42,
"name": "production",
"key": "ng-xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-08-01T09:14:22",
"expires_at": "2027-01-01T00:00:00",
"is_enabled": true,
"credit_limit": 25,
"default_routing_strategy": null,
"message": "Store this key now — it is not shown again."
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "Invalid provisioning key."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Create an API key
Creates an API key on the account and returns its secret this once. Requires a provisioning key.
curl https://api.naga.ac/v1/account/keys \
-H "Authorization: Bearer $NAGA_PROVISIONING_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "production",
"credit_limit": 25.0,
"expires_at": "2027-01-01T00:00:00Z"
}'import requests
url = "https://api.naga.ac/v1/account/keys"
payload = { "name": "production" }
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({name: 'production'})
};
fetch('https://api.naga.ac/v1/account/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.naga.ac/v1/account/keys"
payload := strings.NewReader("{\n \"name\": \"production\"\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))
}{
"id": 42,
"name": "production",
"key": "ng-xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-08-01T09:14:22",
"expires_at": "2027-01-01T00:00:00",
"is_enabled": true,
"credit_limit": 25,
"default_routing_strategy": null,
"message": "Store this key now — it is not shown again."
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "Invalid provisioning key."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
An account provisioning key. Send it as Authorization: Bearer <key>. Provisioning keys manage the account and cannot reach a model.
Body
The body of POST /v1/account/keys.
A label for the key, between 1 and 255 characters.
How many credits this key may spend before the gateway turns it away. Absent means no limit of its own.
When the key should stop working; a past instant draws a refusal. Both grammars count.
The routing strategy for requests that name none. Absent lets NagaAI choose. An unknown name draws a 400.
reliability, balanced, latency, throughput, cache Response
The freshly minted key, and the one answer carrying the secret itself.
The created key, and the only copy of its secret you will be given.
The created key's id, which is the {key_id} the per-key routes take.
The label the request asked for.
The secret itself, in full, and the one answer carrying it.
When the key was created: UTC to the second, without an offset.
When the key stops working, or null when the request asked for none.
Whether the key works at all. Creation inserts it enabled.
The limit the request asked for, or null when it asked for none.
The default routing strategy the request asked for, or null when NagaAI chooses.
reliability, balanced, latency, throughput, cache A fixed reminder that key above is shown once.