Documentation
Configuring OpenAI
- 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:
apiVersion: kagent.dev/v1alpha1kind: ModelConfigmetadata:name: openai-model-confignamespace: kagentspec:apiKeySecretRef: kagent-openaiapiKeySecretKey: OPENAI_API_KEYmodel: gpt-4o-miniprovider: OpenAIopenAI: {}
For OpenAI's standard models like GPT-4 and GPT-3.5, kagent automatically configures the appropriate model capabilities. However, you can override these settings using the modelInfo
field if needed. For more information about model capabilities and configuration, see Custom Models.
- 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.