Skip to content

Commit f765a65

Browse files
authored
docs: enhance OpenRouter API integration docs (#167)
- Add documentation for switching to OpenRouter API Service in README.md - Include instructions for setting OpenRouter API configurations and model selection - Provide details on how to include an app in openrouter.ai rankings and set relevant HTTP headers in the config file Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent 323ff14 commit f765a65

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,33 @@ Update the `base_url` in your config file. You don't need to set the `api_key` i
171171
codegpt config set openai.base_url http://localhost:11434/v1
172172
```
173173

174+
### How to change to [OpenRouter][50] API Service
175+
176+
You can see the [supported models list][51], model usage can be paid by users, developers, or both, and may shift in [availability][52]. You can also fetch models, prices, and limits [via API][53].
177+
178+
The following example use free model name: `meta-llama/llama-3-8b-instruct:free`
179+
180+
```sh
181+
codegpt config ser openai.provider openai
182+
codegpt config set openai.base_url https://openrouter.ai/api/v1
183+
codegpt config set openai.api_key sk-or-v1-xxxxxxxxxxxxxxxx
184+
codegpt config set openai.model meta-llama/llama-3-8b-instruct:free
185+
```
186+
187+
[50]:https://openrouter.ai/
188+
[51]:https://openrouter.ai/docs#models
189+
[52]:https://openrouter.ai/terms#services
190+
[53]:https://openrouter.ai/api/v1/models
191+
192+
For including your app on openrouter.ai rankings and Shows in rankings on openrouter.ai, you can set the `openai.headers` in your config file.
193+
194+
```sh
195+
codegpt config set openai.headers "HTTP-Referer=https://github.com/appleboy/CodeGPT X-Title=CodeGPT"
196+
```
197+
198+
**HTTP-Refer**: Optional, for including your app on openrouter.ai rankings.
199+
**X-Title**: Optional, for Shows in rankings on openrouter.ai.
200+
174201
## Usage
175202

176203
There are two methods for generating a commit message using the `codegpt` command. The first is CLI mode, and the second is Git Hook.

0 commit comments

Comments
 (0)