Skip to main content
POST
/
access-key-configurations
Create an AI Gateway access key configuration
curl --request POST \
  --url https://api.ngrok.ai/access-key-configurations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "metadata": "<string>",
  "access": {
    "providers": {
      "allow": [
        "<string>"
      ]
    },
    "models": {
      "allow": [
        "<string>"
      ]
    }
  },
  "router": {
    "rules": [
      {
        "steps": [
          {
            "keys": [
              {
                "id": "<string>",
                "name": "<string>",
                "value": "<string>"
              }
            ],
            "keySelectionStrategy": "ordered"
          }
        ],
        "provider": "<string>",
        "model": "<string>"
      }
    ]
  }
}
'
{
  "id": "<string>",
  "uri": "<string>",
  "name": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "createdBy": {
    "id": "<string>",
    "uri": "<string>"
  },
  "lastUpdatedBy": {
    "id": "<string>",
    "uri": "<string>"
  },
  "description": "<string>",
  "metadata": "<string>",
  "access": {
    "providers": {
      "allow": [
        "<string>"
      ]
    },
    "models": {
      "allow": [
        "<string>"
      ]
    }
  },
  "router": {
    "rules": [
      {
        "steps": [
          {
            "keys": [
              {
                "id": "<string>",
                "name": "<string>",
                "keyRedacted": "<string>"
              }
            ],
            "keySelectionStrategy": "ordered"
          }
        ],
        "provider": "<string>",
        "model": "<string>"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required

User-defined label for this configuration.

Maximum string length: 255
description
string

Human-readable description.

Maximum string length: 255
metadata
string

Arbitrary user-defined metadata.

Maximum string length: 4096
access
object

Scope controlling which providers and models are reachable. Omit the entire object for allow-all. Each dimension is independently optional.

router
object

Routing configuration. Omit to use defaults: built-in providers get an implicit ngrok step; user-defined providers fail until a rule with user keys exists.

Response

The created AI Gateway access key configuration.

id
string
required

Unique identifier for this configuration.

uri
string
required

URI of this AI Gateway Access Key Configuration API resource.

name
string
required

User-defined label for this configuration.

createdAt
string<date-time>
required

Timestamp when the configuration was created.

updatedAt
string<date-time>
required

Timestamp when the configuration was last updated.

createdBy
object
required
lastUpdatedBy
object
required
description
string

Human-readable description.

metadata
string

Arbitrary user-defined metadata.

access
object

Scope controlling which providers and models are reachable. Omit the entire object for allow-all. Each dimension is independently optional.

router
object