Documentation
Configuring Custom Models
Often you may want to use a custom model with an existing provider, for example if you're using a self-hosted model exposed via the OpenAI API. Or if you're using a proxy to the OpenAI API.
We require certain information about any model to be able to use it. We ship with a default set of models, but you can also add custom models.
The example below will add an API key, but given that this is a custom provider, the key is optional.
- Create a Kubernetes Secret that stores the API key, replace
<your_api_key>
with an actual API key:
export OPENAI_API_KEY=<your_api_key>kubectl create secret generic kagent-openai -n kagent --from-literal OPENAI_API_KEY=$OPENAI_API_KEY
- Create a ModelConfig resource that references the secret and key name, and specify the model you want to use:
apiVersion: kagent.dev/v1alpha1kind: ModelConfigmetadata:name: custom-openai-model-confignamespace: kagentspec:apiKeySecretRef: kagent-openaiapiKeySecretKey: OPENAI_API_KEYmodel: <insert-model-name> # This should match the model name passed to the provider.provider: OpenAIopenAI:baseUrl: https://your-custom-openai-provider.commodelInfo:functionCalling: truefamily: unknown
If you don't need an API key you can elide the apiKeySecretRef
and apiKeySecretKey
fields.
- Apply the above resource to the cluster.
Once the resource is applied, you can select the model from the Model dropdown in the UI when creating or updating agents.