Registering LLM providers in code view
Register LLM provider resources in IBM API Studio by editing YAML files in code view.
- Review resources generated from form view.
- Create or modify LLM provider definitions manually.
When you create an LLM provider in the form view, IBM API Studio automatically generates the LLM API, policy, product, and quota KIND files required to process and manage LLM requests.
The generated resources for LLM provider are as follows:
| kind | Description |
|---|---|
| LLM provider core resources | |
kind: LLMProvider |
Defines the provider configuration, supported operations, authentication, and cache settings. |
kind: MCPTools |
Defines the tools that clients can invoke through the MCP server. |
| LLM policy resources | |
kind: FreeFlowPolicySequence |
Defines the main request processing flow in the Build assembly. |
kind: OperationSwitch |
Routes requests to the appropriate invoke policy based on the provider operation. |
| Invoke policy resources | |
kind: InvokeWatsonxModels
|
Invokes Watsonx.ai LLM provider operations. |
kind: InvokeOpenAiModels
|
Invokes OpenAI and OpenAI-compatible LLM provider operations. |
kind: InvokeAzureOpenAiModels
|
Invokes Azure OpenAI LLM provider operations. |
kind: InvokeGeminiModels
|
Invokes Gemini LLM provider operations. |
| Authentication and authorization policies
|
Process identity, authentication, and access control. |
kind: Telemetry |
Captures monitoring and analytics data. |
kind: Throw |
Handles LLM API error responses. |
kind: If |
Evaluates a condition and runs logic only when the condition is met. |
kind: Set |
Sets or updates context variables used later in the flow. |
| LLM product and plan resources | |
kind: Product |
Defines a product that contains LLM provider APIs and associated policies. |
kind: Plan |
Defines pricing, terms, and access control mechanisms. |
kind: Quota |
Defines the maximum number of requests allowed within a defined time window. |
| Open API resources | |
API |
Defines the generated LLM API resource for provider operations. |
OpenAPI specification |
Defines the generated LLM API operations and endpoints. |
Create or modify an LLM provider kind file
The kind field specifies the type of asset that is defined. When you set the
kind field to LLMProvider, it indicates that the file represents
an LLMProvider configuration. An LLM provider defines how LLM providers (such as Watson.ai, OpenAI)
are securely connected and invoked. It includes provider metadata, supported operations,
authentication, caching behavior, and product association.
- In IBM API Studio, go to the Explorer.
- Expand LLM providers and select the registered LLM provider.
- Switch to the Code view.
- In the project files, open the LLM_provider.yaml file.
kind: LLMProvider
apiVersion: api.ibm.com/v1
metadata:
name: watsonx-conn-sample
namespace: DPNano_Product_LLM_Provider
version: "1.0"
tags: []
labels:
gatewayTypes:
- nano
domain: ai-platform
spec:
provider:
type: watsonx
operations:
- InvokeWatsonxModels
- InvokeWatsonxTextGen
- InvokeWatsonxTokenize
apiKeySecret: watsonx-api-key
tlsClientProfile: tls-client-profile-default:1.0.0
inputMessage: request
cachePolicy:
cache:
expire:
static:
seconds: 60
scope:
narrowScope: {}
ignoreControlDirectives: true
projectId: placeholder-project-id
region: us-south
opVersion: "2024-03-14"
product:
$ref: DPNano_Product_LLM_Provider:product-watsonx-conn-sample-p2k4a:1.0
| Category | Field | Description |
|---|---|---|
kind |
Defines the type of asset. The value LLMProvider indicates that the file
represents an LLM provider configuration. |
|
metadata. Identifies and organizes the LLM provider with essential tags and identifiers. |
name |
Identifies the LLM provider. The name must be unique within the namespace. |
namespace |
Identifies the project that contains the LLM provider. | |
version |
Specifies the LLM provider version for tracking changes. | |
tags |
Assigns keywords to the MCP server for categorizing and filtering LLM providers. | |
labels |
gatewayTypes specifies supported nanogateway
environment. |
|
domain |
Specifies the functional domain: ai-platform. |
|
spec. Defines the structure and behavior of the |
title |
MCP server name visible to users and AI agents when browsing MCP assets. |
description |
Describes the purpose and capabilities of the MCP server. | |
protocolVersion |
Specifies the supported MCP version. | |
type |
Specifies the LLM provider type (for example, watsonx). |
|
operations |
Lists supported LLM provider operations that can be invoked (for example, text generation, tokenization, or model listing). | |
apiKeySecret |
References the secret that stores the API key used for authentication. | |
tlsClientProfile |
References the TLS client profile used for secure communication with the provider. | |
inputMessage |
Specifies the request payload field that contains the input prompt or message. | |
cachePolicy |
Defines caching behavior for responses from the provider. | |
projectId |
Specifies the project identifier associated with the LLM provider (for example, Watsonx project ID). | |
region |
Specifies the service region (for example, us-south). |
|
opVersion |
Specifies the version of the LLM provider API operations. | |
cachePolicy |
Defines caching rules applied to LLM
responses.
|
|
product |
References the product that exposes the LLM provider. The format is
namespace:product_name:version. |