-
-
Notifications
You must be signed in to change notification settings - Fork 75
feat(providers): add Cohere provider #581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
972282d
feat(providers): add Cohere provider
SantiagoDePolonia ada0c70
fix(cohere): address provider review findings
SantiagoDePolonia 1891af0
chore: merge main into feat/cohera
SantiagoDePolonia e92db11
fix(providers): address follow-up review findings
SantiagoDePolonia db20e64
fix(cohere): align translation with live API responses
SantiagoDePolonia 227aded
feat(cohere): add audio transcription support
SantiagoDePolonia 50338da
fix(cohere): propagate stream adapter failures
SantiagoDePolonia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| --- | ||
| title: "Cohere" | ||
| description: "Configure Cohere in GoModel and use Command chat, tool calling, reasoning, image input, audio transcription, and Embed models through OpenAI-compatible APIs." | ||
| icon: "comment" | ||
| --- | ||
|
|
||
| GoModel translates OpenAI-compatible Chat Completions, Responses, Embeddings, | ||
| and Audio Transcription requests to Cohere's native v2 API. Model | ||
| discovery uses Cohere's model catalog and exposes chat, embedding, and | ||
| transcription models through `/v1/models`. | ||
|
|
||
| ## Configure | ||
|
|
||
| ```bash | ||
| COHERE_API_KEY=... | ||
| # COHERE_BASE_URL=https://api.cohere.com # optional override | ||
| ``` | ||
|
|
||
| Or in `config.yaml`: | ||
|
|
||
| ```yaml | ||
| providers: | ||
| cohere: | ||
| type: cohere | ||
| api_key: "${COHERE_API_KEY}" | ||
| ``` | ||
|
|
||
| Multiple keys use the standard `COHERE_API_KEY_2`, | ||
| `COHERE_API_KEY_3`, ... rotation convention. You can restrict or supplement | ||
| model discovery with `COHERE_MODELS`. | ||
|
|
||
| ## Chat and Responses | ||
|
|
||
| Use a Cohere Command model with either OpenAI-compatible endpoint: | ||
|
|
||
| ```bash | ||
| curl http://localhost:8080/v1/chat/completions \ | ||
| -H "Authorization: Bearer $GOMODEL_API_KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": "command-a-plus-05-2026", | ||
| "messages": [{"role": "user", "content": "Explain vector search briefly"}] | ||
| }' | ||
| ``` | ||
|
|
||
| Chat streaming, system and developer messages, image URL parts, JSON response | ||
| formats, tool definitions, tool calls, and tool results are translated to the | ||
| Cohere v2 format. `/v1/responses` uses the same chat adapter. | ||
|
|
||
| Cohere reasoning models enable thinking by default. To control Cohere's native | ||
| reasoning behavior, include its `thinking` object as an extension: | ||
|
|
||
| ```json | ||
| { | ||
| "model": "command-a-reasoning-08-2025", | ||
| "messages": [{"role": "user", "content": "Solve this carefully..."}], | ||
| "thinking": {"type": "enabled", "token_budget": 4000} | ||
| } | ||
| ``` | ||
|
|
||
| Thinking output is returned as the OpenAI-compatible `reasoning_content` | ||
| extension in both normal and streaming responses. | ||
|
|
||
| ## Audio transcription | ||
|
|
||
| Cohere audio uses a dedicated speech-to-text model and endpoint; Command chat | ||
| models do not accept audio content mixed into Chat Completions or Responses. | ||
| Transcribe audio through the OpenAI-compatible endpoint: | ||
|
|
||
| ```bash | ||
| curl http://localhost:8080/v1/audio/transcriptions \ | ||
| -H "Authorization: Bearer $GOMODEL_API_KEY" \ | ||
| -F "model=cohere/cohere-transcribe-03-2026" \ | ||
| -F "language=en" \ | ||
| -F "response_format=json" \ | ||
| -F "file=@recording.wav" | ||
| ``` | ||
|
|
||
| The Cohere transcription API requires `language` and returns JSON. GoModel | ||
| accepts the OpenAI-compatible `response_format=json` field but omits it from the | ||
| native request because JSON is Cohere's fixed response format. Cohere does not | ||
| support text-to-speech, prompt hints, timestamp granularities, or streaming | ||
| transcription. | ||
|
|
||
| ## Embeddings | ||
|
|
||
| GoModel supplies Cohere's required embedding fields while retaining the | ||
| OpenAI request shape: | ||
|
|
||
| ```bash | ||
| curl http://localhost:8080/v1/embeddings \ | ||
| -H "Authorization: Bearer $GOMODEL_API_KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "model": "embed-v4.0", | ||
| "input": ["first document", "second document"], | ||
| "dimensions": 1024, | ||
| "input_type": "search_document" | ||
| }' | ||
| ``` | ||
|
|
||
| `input_type` defaults to `search_document`. Set it to `search_query`, | ||
| `classification`, or `clustering` when that better describes the input. | ||
| `encoding_format` supports `float` (the default) and `base64`. Cohere-native | ||
| `truncate`, `max_tokens`, and `priority` fields are also passed through. | ||
|
|
||
| ## Native passthrough | ||
|
|
||
| Add `cohere` to `server.enabled_passthrough_providers`, then use paths such as | ||
| `/p/cohere/v2/chat` or `/p/cohere/v2/rerank` to call Cohere-native APIs that do | ||
| not have an OpenAI-compatible GoModel surface. | ||
|
|
||
| See Cohere's [Chat API](https://docs.cohere.com/reference/chat), | ||
| [Embed API](https://docs.cohere.com/reference/embed), | ||
| [Audio Transcription API](https://docs.cohere.com/reference/create-audio-transcription), | ||
| and [reasoning guide](https://docs.cohere.com/docs/reasoning) for native fields | ||
| and model-specific capabilities. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...oard/static/dist/assets/index-DmWIREH6.js → ...oard/static/dist/assets/index-BeTR3jY3.js
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.