Ana içeriğe geç

Create LLM Provider Definition

Endpoint

POST /apiops/projects/{projectName}/llm-provider-definitions/{definitionName}/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
definitionNamestringYesProvider catalog definition name (must match the effective name in the body)

Query Parameters

None

Request Body

The body is an LlmProviderDefinition object — unlike Create LLM Provider, this is a plain entity, not a polymorphic type, so no _class discriminator is required or accepted.

Full JSON Body Example

{
"name": "internal-llm-gateway",
"code": "internal-llm-gateway",
"displayName": "Internal LLM Gateway",
"defaultEndpoint": "https://llm-gateway.internal.example.com/v1",
"defaultApiVersion": "v1",
"defaultAuthScheme": "API_KEY_HEADER",
"defaultAuthHeaderName": "x-api-key",
"iconUrl": "https://cdn.example.com/icons/internal-llm.svg",
"docsUrl": "https://wiki.internal.example.com/llm-gateway"
}

Request Body Fields

FieldTypeRequiredDefaultDescription
namestringNocode value, then path valueDefinition name; if blank, falls back to code, then to definitionName. Must match definitionName in the path (case-insensitive) once resolved
codestringNo-Provider type code (e.g. internal-llm-gateway); used as the name fallback when name is blank
displayNamestringNo-UI label
defaultEndpointstringNo-Default base API URL
defaultApiVersionstringNo-Default API version
defaultAuthSchemestringNo-Default auth scheme enum constant (BEARER, API_KEY_HEADER, BASIC, AWS_SIGV4, OAUTH2, NONE, CUSTOM)
defaultAuthHeaderNamestringNo-Default credential header name
iconUrlstringNo-Provider icon URL
docsUrlstringNo-Vendor documentation deep link
builtInbooleanNoforced falseIgnored on write and always persisted as false. Sending "builtIn": true is rejected outright (see below)
id, projectId, lastUpdatedAtNoserver-assignedAny value sent for these fields is ignored — id/projectId are resolved server-side (upsert lookup / path project), lastUpdatedAt is always set to the current time

Notes

  • name must match definitionName in the path (case-insensitive) once resolved (namecode → path fallback), otherwise a 400 Bad Request is returned
  • Sending "builtIn": true in the body is rejected with a 400 Bad Request ("Built-in provider definitions are read-only."), regardless of whether a definition with that name already exists
  • No _class discriminator — this is a plain entity body, not a polymorphic ConnectionConfig subtype

Response

Success Response (200 OK)

{
"status": "SUCCESS",
"deploymentResult": {
"success": true
}
}

EnumStatus

  • SUCCESS - Operation successful
  • FAILURE - Operation failed

Error Response (400 Bad Request)

{
"status": "FAILURE",
"resultMessage": "Built-in provider definitions are read-only."
}

or

{
"status": "FAILURE",
"resultMessage": "Provider definition name in path (internal-llm-gateway) does not match name in body (other-name)!"
}

or

{
"status": "FAILURE",
"resultMessage": "Provider definition body can not be empty!"
}

Error Response (401 Unauthorized)

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

cURL Example

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/llm-provider-definitions/internal-llm-gateway/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "internal-llm-gateway",
"code": "internal-llm-gateway",
"displayName": "Internal LLM Gateway",
"defaultEndpoint": "https://llm-gateway.internal.example.com/v1",
"defaultApiVersion": "v1",
"defaultAuthScheme": "API_KEY_HEADER",
"defaultAuthHeaderName": "x-api-key"
}'

Permissions

  • User must have AI_DEVELOPMENT + MANAGE permission in the project

Notes and Warnings

  • Upsert Semantics:
    • If a definition with the same name already exists in the caller's visible scope (built-in ∪ this project's custom entries) and is not built-in, it is updated (its internal ID is reused)
    • Otherwise a new definition is created, owned by the calling project
  • Built-in Is Read-Only:
    • Both the target of an update (an already-built-in row) and the incoming body ("builtIn": true) are checked — either one is rejected with the same stable message
  • No _class Discriminator:
    • Unlike ConnectionConfigLlm (LLM Provider) bodies, this entity is not polymorphic
  • No Secrets, No Deploy:
    • The entity carries no credential fields, and creating a definition never triggers an AI Gateway worker deploy — deploymentResult reflects the database write only