feat(provider): add Cohere as first-class OpenAI-compatible preset (#18)#204
Merged
Merged
Conversation
Adds Cohere to the provider catalog as requested in issue #18. Cohere ships an OpenAI-compatible endpoint at /compatibility/v1 that accepts the OpenAI Chat Completions request shape — meaning a full native provider impl (the original ask) is not the only path. A first-class preset gives users `jcode login --provider cohere`, `--provider command-a`, or `--provider command-r` with the rest of the auth/runtime stack (model catalog, env file, login UI, doctor) automatically. Implementation: - crates/jcode-provider-metadata/src/catalog.rs: - Added COHERE_PROFILE alongside DEEPSEEK_PROFILE. - api_base: https://api.cohere.com/compatibility/v1 - api_key_env: COHERE_API_KEY - env_file: cohere.env - default_model: command-a-03-2025 - setup_url: https://docs.cohere.com/v2/docs/compatibility-api - Added COHERE_LOGIN_PROVIDER with aliases ["command-r", "command-a"] so the substring shortcut model-family typing works. - Bumped OPENAI_COMPAT_PROFILES array size 32 -> 33. - Bumped LOGIN_PROVIDERS array size 45 -> 46. - crates/jcode-provider-metadata/src/lib.rs: - Added regression test cohere_profile_uses_openai_compatibility_endpoint pinning api_base, api_key_env, env_file, default_model, requires_api_key, login provider routing, and alias resolution ("command-a", "command-r" both round-trip to cohere). Closes #18 Note: the issue text asks for a full native v2/chat implementation to use idiomatic Cohere tool format. A native impl can be added later without breaking this preset (analogous to how the OpenAI-compat fallback for Anthropic/etc coexists with native impls today). The preset is a meaningful first cut: it makes Cohere's v0 tools usable inside jcode immediately.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds Cohere to the provider catalog as requested in issue #18. Cohere ships an OpenAI-compatible endpoint at
/compatibility/v1that accepts the OpenAI Chat Completions request shape — meaning a full native provider impl (the original ask) is not the only path. A first-class preset gives usersjcode login --provider cohere,--provider command-a, or--provider command-rwith the rest of the auth/runtime stack (model catalog, env file, login UI, doctor) automatically.Changes
COHERE_PROFILE(api_basehttps://api.cohere.com/compatibility/v1, api_key_envCOHERE_API_KEY, env_filecohere.env, default_modelcommand-a-03-2025, setup_urlhttps://docs.cohere.com/v2/docs/compatibility-api).COHERE_LOGIN_PROVIDERwith aliases["command-r", "command-a"]so model-family shortcuts work.OPENAI_COMPAT_PROFILESarray size: 32 → 33.LOGIN_PROVIDERSarray size: 45 → 46.cohere_profile_uses_openai_compatibility_endpointpinsapi_base,api_key_env,env_file,default_model,requires_api_key, login-provider routing, and alias resolution.Tests
Notes
The issue text asks for a full native v2/chat implementation to use idiomatic Cohere tool format. A native impl can be added later without breaking this preset (analogous to how the OpenAI-compat fallback for Anthropic/etc coexists with native impls today). The preset is a meaningful first cut: it makes Cohere's Command-R / Command-A available inside jcode immediately for chat + simple tool use.