Skip to content

Commit 005f6da

Browse files
authored
Merge pull request #208 from kagent-dev/adb-byo-model
docs: BYO OpenAI-compatible provider
2 parents 97a09b5 + 612e1d0 commit 005f6da

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

public/sitemap.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,14 @@
212212

213213
<url>
214214
<loc>https://kagent.dev/docs/kagent/supported-providers/azure-openai</loc>
215-
<lastmod>2025-09-10</lastmod>
215+
<lastmod>2025-09-09</lastmod>
216+
<changefreq>weekly</changefreq>
217+
<priority>0.8</priority>
218+
</url>
219+
220+
<url>
221+
<loc>https://kagent.dev/docs/kagent/supported-providers/byo-openai</loc>
222+
<lastmod>2025-09-09</lastmod>
216223
<changefreq>weekly</changefreq>
217224
<priority>0.8</priority>
218225
</url>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: "BYO OpenAI-compatible model"
3+
pageOrder: 7
4+
description: "Bring your own OpenAI-compatible model to kagent."
5+
---
6+
7+
export const metadata = {
8+
title: "BYO OpenAI-compatible model",
9+
description: "Bring your own OpenAI-compatible model to kagent.",
10+
author: "kagent.dev"
11+
};
12+
13+
You can bring your own model from an [OpenAI API-compatible](https://platform.openai.com/docs/api-reference/introduction) LLM provider. The example integrates with [Cohere AI](https://cohere.com/).
14+
15+
1. Save your API key from the OpenAI-compatible provider as an environment variable. For example, navigate to the [Cohere AI dashboard](https://dashboard.cohere.com/api-keys).
16+
17+
```bash
18+
export PROVIDER_API_KEY=Dgs...
19+
```
20+
21+
2. Create a Kubernetes secret that stores your API key. Make sure to create the secret in the same namespace as you plan to create your agent, such as `kagent`.
22+
23+
```bash
24+
kubectl create secret generic kagent-my-provider -n kagent --from-literal PROVIDER_API_KEY=$PROVIDER_API_KEY
25+
```
26+
27+
3. Create a ModelConfig resource.
28+
29+
```yaml
30+
kubectl apply -f - <<EOF
31+
apiVersion: kagent.dev/v1alpha2
32+
kind: ModelConfig
33+
metadata:
34+
name: my-provider-config
35+
namespace: kagent
36+
spec:
37+
apiKeySecret: kagent-my-provider
38+
apiKeySecretKey: PROVIDER_API_KEY
39+
model: command-a-03-2025
40+
provider: OpenAI
41+
openAI:
42+
baseUrl: "https://api.cohere.ai/compatibility/v1"
43+
EOF
44+
```
45+
46+
Review the following table to understand this configuration. For more information, see the [API docs](https://kagent.dev/docs/kagent/resources/api-ref#openaiconfig).
47+
48+
| Setting | Description |
49+
| --- | --- |
50+
| `apiKeySecret` | The name of the Kubernetes secret that stores your API key. |
51+
| `apiKeySecretKey` | The key in the secret that stores your API key. |
52+
| `model` | The OpenAI API-compatible model to use. For more information about the model, consult your LLM provider's documentation. For example, you might use `command-a-03-2025` for [Cohere AI](https://docs.cohere.com/v1/docs/models). |
53+
| `provider` | To use an OpenAI API-compatible model, set the provider to `OpenAI`. |
54+
| `openAI` | Additional provider details. For available settings, consult your LLM provider's documentation. At the least, you must configure the `baseUrl` setting to point to the endpoint of your LLM provider. |
55+
| `baseUrl` | The base URL of your LLM provider. Note that the LLM provider might have a special base URL for OpenAI compatibility, such as `"https://api.cohere.ai/compatibility/v1"` for [Cohere AI](https://cohere.com/). |
56+
57+
Good job! You added a model to kagent. Next, you can [create or update an agent](https://kagent.dev/docs/kagent/getting-started/first-agent) to use this model.

src/config/navigation.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@
120120
"title": "OpenAI",
121121
"href": "/docs/kagent/supported-providers/openai",
122122
"description": "Learn how to configure OpenAI models in kagent."
123+
},
124+
{
125+
"title": "BYO OpenAI-compatible model",
126+
"href": "/docs/kagent/supported-providers/byo-openai",
127+
"description": "Bring your own OpenAI-compatible model to kagent."
123128
}
124129
]
125130
},

0 commit comments

Comments
 (0)