Skip to content

Provider OpenAI compatible

Muhammet Şafak edited this page Oct 18, 2026 · 5 revisions

Home / Providers / OpenAI-compatible (DeepSeek, Mistral, Cohere, custom)

Providers: deepseek, mistral, cohere, openai-compatible

These three providers talk to OpenAI-compatible Chat Completions endpoints, so CommitBrief drives them through the same openai-go SDK it uses for OpenAI — just pointed at a different base URL. No extra dependency is pulled in for them.

Provider Default base URL API key env Default model Other models
deepseek https://api.deepseek.com DEEPSEEK_API_KEY deepseek-chat deepseek-reasoner
mistral https://api.mistral.ai/v1 MISTRAL_API_KEY mistral-large-latest mistral-small-latest, codestral-latest
cohere https://api.cohere.ai/compatibility/v1 COHERE_API_KEY command-r-plus command-r, command-a-03-2025

Setup

commitbrief setup            # pick DeepSeek / Mistral / Cohere + enter the key
# or set the key in config / via the env var, then:
commitbrief providers use deepseek
commitbrief --provider mistral --staged

The API key can come from config (providers.<name>.api_key) or the matching environment variable above.

Structured output

Unlike the OpenAI provider, these do not send a response_format JSON-schema directive — their strict-JSON support varies by provider and model. The findings JSON shape comes from the system prompt's contract, and the salvage → repair-retry → degrade pipeline handles output that doesn't parse — fenced JSON is salvaged with no retry, a real parse failure gets one repair-oriented retry, and only then does it fall back to rendering the raw text — exactly the way Ollama works. In practice capable models follow the prompt; smaller ones may degrade to plain-text output.

Pricing

Per-1M-token rates are hard-coded snapshots (internal/provider/<name>/pricing.go) and shown in the --verbose footer. Refresh them when a provider changes prices. No automatic prompt-cache discount is assumed for Mistral/Cohere; DeepSeek's cache-hit rate is listed but may not be reported through the compatibility usage payload.

deepseek, mistral and cohere no longer send OPENAI_ORG_ID and OPENAI_PROJECT_ID as OpenAI-Organization / OpenAI-Project headers.

openai-compatible

Requires v1.19.0 or later. For any other endpoint that speaks Chat Completions (vLLM, LM Studio, LiteLLM, a corporate gateway).

provider: openai-compatible
providers:
  openai-compatible:
    base_url: http://localhost:8000/v1   # required
    model: qwen2.5-coder-32b-instruct    # required
    api_key_env: LOCAL_LLM_KEY           # optional
    context_window: 32768                # optional, enables the token preflight
    pricing:
      qwen2.5-coder-32b-instruct: { input_per_1m: 0.40, output_per_1m: 1.20 }
  • Key lookup: api_key_env, then api_key, then no Authorization header.
  • No response_format is sent.
  • OpenAI-Organization and OpenAI-Project headers are never sent.
  • No price declared: cost shows as unknown, one stderr note is printed and the cost confirmation is skipped. A price of 0.0 counts as not declared.
  • No context_window: the token preflight is skipped with a note.
  • Plain http:// to a non-loopback host prints a one-line stderr warning, also under --quiet; it is never a refusal.
  • doctor fails when api_key_env names an empty variable; dry-run prints Cost estimate: unknown and, when the provider cannot be built, Provider unavailable: <reason>.

See also

  • Providers — all backends + capability comparison.
  • OpenAI — the native OpenAI provider (uses strict response_format).
  • Output formats — structured findings vs graceful degrade.

See also: Providers

Clone this wiki locally