Skip to content

feat(provider): add Cohere as first-class OpenAI-compatible preset (#18)#204

Merged
quangdang46 merged 1 commit into
masterfrom
feat/cohere-openai-compat-provider
May 22, 2026
Merged

feat(provider): add Cohere as first-class OpenAI-compatible preset (#18)#204
quangdang46 merged 1 commit into
masterfrom
feat/cohere-openai-compat-provider

Conversation

@quangdang46
Copy link
Copy Markdown
Owner

What

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.

Changes

  • crates/jcode-provider-metadata/src/catalog.rs:
    • COHERE_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).
    • COHERE_LOGIN_PROVIDER with aliases ["command-r", "command-a"] so model-family shortcuts work.
    • OPENAI_COMPAT_PROFILES array size: 32 → 33.
    • LOGIN_PROVIDERS array size: 45 → 46.
  • crates/jcode-provider-metadata/src/lib.rs:
    • Test cohere_profile_uses_openai_compatibility_endpoint pins api_base, api_key_env, env_file, default_model, requires_api_key, login-provider routing, and alias resolution.

Tests

$ cargo test -p jcode-provider-metadata cohere
test result: ok. 1 passed; 0 failed
$ cargo test -p jcode --lib auth_issue_profile_metadata
test result: ok. 1 passed; 0 failed
$ cargo test -p jcode-provider-metadata
test result: ok. 11 passed; 0 failed

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.

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.
@quangdang46 quangdang46 merged commit 1a15a97 into master May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant