di-sukharev / di-sukharev/opencommit

[Feature]: support groq

Open
#346 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
7.5k
Forks
445
Avg merge
18m
Merged PRs (30d)
2

Description

Description

Add support for API at groq.com.

Suggested Solution

groq api is compatible with openai api so basically no additional functionality is required.

Alternatives

I achieved groq support by opencommit just by removing corresponding checks for API key name and model name in cli.cjs:

["OCO_OPENAI_API_KEY" /* OCO_OPENAI_API_KEY */](value, config9 = {}) {
  validateConfig(
    "OpenAI API_KEY",
    value || config9.OCO_ANTHROPIC_API_KEY || config9.OCO_AI_PROVIDER == "ollama" || config9.OCO_AI_PROVIDER == "test",
    "You need to provide an OpenAI/Anthropic API key"
  );
  // Removed the check for the key starting with "sk-"
  return value;
},
["OCO_MODEL" /* OCO_MODEL */](value) {
  // Removed the validation that checks if the model name is in the predefined list
  return value;
},
var MODEL = config3?.OCO_MODEL || "gpt-3.5-turbo";
// Removed the validation that checks if the model name is in the predefined list

my .opencommit config:

OCO_OPENAI_API_KEY=MY_SECRET_GROQ_KEY
OCO_ANTHROPIC_API_KEY=undefined
OCO_TOKENS_MAX_INPUT=undefined
OCO_TOKENS_MAX_OUTPUT=undefined
OCO_OPENAI_BASE_PATH=https://api.groq.com/openai/v1
OCO_DESCRIPTION=false
OCO_EMOJI=false
OCO_MODEL=llama3-70b-8192
OCO_LANGUAGE=en
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=$msg
OCO_PROMPT_MODULE=conventional-commit
OCO_AI_PROVIDER=openai
OCO_GITPUSH=false
OCO_ONE_LINE_COMMIT=false
Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the API-key, model, and base-path validation and request setup in cli.cjs, using the configuration examples in the issue as the expected inputs. Confirm that a Groq endpoint and model pass validation and that the CLI can generate a commit message through that endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.