Skip to main content

Management API: LLM Provider Template Management

You're reading API Gateway 1.0.0. The newest release is 1.2.0. Go to the newest release

CRUD operations for LLM Provider Template configurations

Create a new LLM provider template​

POST /llm-provider-templates

Code samples


curl -X POST http://localhost:9090/api/management/v0.9/llm-provider-templates \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Add a new LLM provider template to the Gateway. A template defines token tracking and model extraction metadata for an LLM provider.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "LlmProviderTemplate",
"metadata": {
"name": "openai-template"
},
"spec": {
"displayName": "OpenAI",
"promptTokens": {
"location": "payload",
"identifier": "$.usage.prompt_tokens"
},
"completionTokens": {
"location": "payload",
"identifier": "$.usage.completion_tokens"
},
"totalTokens": {
"location": "payload",
"identifier": "$.usage.total_tokens"
},
"remainingTokens": {
"location": "header",
"identifier": "x-ratelimit-remaining-tokens"
},
"requestModel": {
"location": "payload",
"identifier": "$.model"
},
"responseModel": {
"location": "payload",
"identifier": "$.model"
}
}
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`

Parameters​

NameInTypeRequiredDescription
bodybodyLLMProviderTemplateRequesttruenone

Example responses

201 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "LlmProviderTemplate",
"metadata": {
"name": "openai-template"
},
"spec": {
"displayName": "OpenAI",
"promptTokens": {
"location": "payload",
"identifier": "$.usage.prompt_tokens"
},
"completionTokens": {
"location": "payload",
"identifier": "$.usage.completion_tokens"
},
"totalTokens": {
"location": "payload",
"identifier": "$.usage.total_tokens"
},
"remainingTokens": {
"location": "header",
"identifier": "x-ratelimit-remaining-tokens"
},
"requestModel": {
"location": "payload",
"identifier": "$.model"
},
"responseModel": {
"location": "payload",
"identifier": "$.model"
}
},
"status": {
"id": "openai-template",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

StatusMeaningDescriptionSchema
201CreatedLLM provider template created successfullyLLMProviderTemplate
400Bad RequestInvalid configuration (validation failed)ErrorResponse
409ConflictConflict - Template with same name already existsErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

List all LLM provider templates​

GET /llm-provider-templates

Code samples


curl -X GET http://localhost:9090/api/management/v0.9/llm-provider-templates \
-u {username}:{password} \
-H 'Accept: application/json'

List LLM provider templates registered in the Gateway, optionally filtered by name.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`

Parameters​

NameInTypeRequiredDescription
displayNamequerystringfalseFilter by template display name

Example responses

200 Response

{
"status": "success",
"count": 3,
"templates": [
{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "LlmProviderTemplate",
"metadata": {
"name": "openai-template"
},
"spec": {
"displayName": "OpenAI",
"promptTokens": {
"location": "payload",
"identifier": "$.usage.prompt_tokens"
},
"completionTokens": {
"location": "payload",
"identifier": "$.usage.completion_tokens"
},
"totalTokens": {
"location": "payload",
"identifier": "$.usage.total_tokens"
},
"remainingTokens": {
"location": "header",
"identifier": "x-ratelimit-remaining-tokens"
},
"requestModel": {
"location": "payload",
"identifier": "$.model"
},
"responseModel": {
"location": "payload",
"identifier": "$.model"
}
},
"status": {
"id": "openai-template",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z"
}
}
]
}

Responses​

StatusMeaningDescriptionSchema
200OKList of LLM provider templatesInline
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
countintegerfalsenonenone
templates[allOf]falsenonenone

allOf

NameTypeRequiredRestrictionsDescription
anonymousLLMProviderTemplateRequestfalsenonenone
apiVersionstringtruenoneTemplate specification version
kindstringtruenoneTemplate kind
metadataMetadatatruenonenone
namestringtruenoneUnique handle for the resource
labelsobjectfalsenoneLabels are key-value pairs for organizing and selecting APIs. Keys must not contain spaces.
additionalPropertiesstringfalsenonenone
annotationsobjectfalsenoneAnnotations are arbitrary non-identifying metadata. Use domain-prefixed keys.
additionalPropertiesstringfalsenonenone
specLLMProviderTemplateDatatruenonenone
displayNamestringtruenoneHuman-readable LLM Template name
promptTokensExtractionIdentifierfalsenonenone
locationstringtruenoneWhere to find the token information
identifierstringtruenoneJSONPath expression or header name to identify the token value
completionTokensExtractionIdentifierfalsenonenone
totalTokensExtractionIdentifierfalsenonenone
remainingTokensExtractionIdentifierfalsenonenone
requestModelExtractionIdentifierfalsenonenone
responseModelExtractionIdentifierfalsenonenone
resourceMappingsLLMProviderTemplateResourceMappingsfalsenonenone
resources[LLMProviderTemplateResourceMapping]falsenonenone
resourcestringtruenoneResource path pattern for this mapping
promptTokensExtractionIdentifierfalsenonenone
completionTokensExtractionIdentifierfalsenonenone
totalTokensExtractionIdentifierfalsenonenone
remainingTokensExtractionIdentifierfalsenonenone
requestModelExtractionIdentifierfalsenonenone
responseModelExtractionIdentifierfalsenonenone

and

NameTypeRequiredRestrictionsDescription
anonymousobjectfalsenonenone
statusResourceStatusfalseread-onlyServer-managed lifecycle fields. Populated on responses.
idstringfalsenoneUnique identifier assigned by the server (equal to metadata.name)
statestringfalsenoneDesired deployment state reported by the server
createdAtstring(date-time)falsenoneTimestamp when the resource was first created (UTC)
updatedAtstring(date-time)falsenoneTimestamp when the resource was last updated (UTC)
deployedAtstring(date-time)falsenoneTimestamp when the resource was last deployed (omitted when undeployed)

Enumerated Values​

PropertyValue
apiVersiongateway.api-platform.wso2.com/v1alpha1
kindLlmProviderTemplate
locationpayload
locationheader
locationqueryParam
locationpathParam
statedeployed
stateundeployed

Get LLM provider template by id​

GET /llm-provider-templates/{id}

Code samples


curl -X GET http://localhost:9090/api/management/v0.9/llm-provider-templates/{id} \
-u {username}:{password} \
-H 'Accept: application/json'

Get an LLM provider template by its ID.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier for the LLM provider template

Example responses

200 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "LlmProviderTemplate",
"metadata": {
"name": "openai-template"
},
"spec": {
"displayName": "OpenAI",
"promptTokens": {
"location": "payload",
"identifier": "$.usage.prompt_tokens"
},
"completionTokens": {
"location": "payload",
"identifier": "$.usage.completion_tokens"
},
"totalTokens": {
"location": "payload",
"identifier": "$.usage.total_tokens"
},
"remainingTokens": {
"location": "header",
"identifier": "x-ratelimit-remaining-tokens"
},
"requestModel": {
"location": "payload",
"identifier": "$.model"
},
"responseModel": {
"location": "payload",
"identifier": "$.model"
}
},
"status": {
"id": "openai-template",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKLLM provider template detailsLLMProviderTemplate
404Not FoundLLM provider template not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Update an existing LLM provider template​

PUT /llm-provider-templates/{id}

Code samples


curl -X PUT http://localhost:9090/api/management/v0.9/llm-provider-templates/{id} \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Update an existing LLM provider template in the Gateway.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "LlmProviderTemplate",
"metadata": {
"name": "openai-template"
},
"spec": {
"displayName": "OpenAI",
"promptTokens": {
"location": "payload",
"identifier": "$.usage.prompt_tokens"
},
"completionTokens": {
"location": "payload",
"identifier": "$.usage.completion_tokens"
},
"totalTokens": {
"location": "payload",
"identifier": "$.usage.total_tokens"
},
"remainingTokens": {
"location": "header",
"identifier": "x-ratelimit-remaining-tokens"
},
"requestModel": {
"location": "payload",
"identifier": "$.model"
},
"responseModel": {
"location": "payload",
"identifier": "$.model"
}
}
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the template to update
bodybodyLLMProviderTemplateRequesttruenone

Example responses

200 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "LlmProviderTemplate",
"metadata": {
"name": "openai-template"
},
"spec": {
"displayName": "OpenAI",
"promptTokens": {
"location": "payload",
"identifier": "$.usage.prompt_tokens"
},
"completionTokens": {
"location": "payload",
"identifier": "$.usage.completion_tokens"
},
"totalTokens": {
"location": "payload",
"identifier": "$.usage.total_tokens"
},
"remainingTokens": {
"location": "header",
"identifier": "x-ratelimit-remaining-tokens"
},
"requestModel": {
"location": "payload",
"identifier": "$.model"
},
"responseModel": {
"location": "payload",
"identifier": "$.model"
}
},
"status": {
"id": "openai-template",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKLLM provider template updated successfullyLLMProviderTemplate
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundLLM provider template not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Delete an LLM provider template​

DELETE /llm-provider-templates/{id}

Code samples


curl -X DELETE http://localhost:9090/api/management/v0.9/llm-provider-templates/{id} \
-u {username}:{password} \
-H 'Accept: application/json'

Delete an LLM provider template from the Gateway.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the template to delete

Example responses

200 Response

{
"status": "success",
"message": "LLM provider template deleted successfully",
"id": "openai"
}

Responses​

StatusMeaningDescriptionSchema
200OKLLM provider template deleted successfullyInline
404Not FoundLLM provider template not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
messagestringfalsenonenone
idstringfalsenonenone

Was this page helpful?