di-sukharev / di-sukharev/opencommit

[Feature]: Support for Github Models (Github Marketplace)

Open
#410 1 comment 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

Currently opencommit doesn't support Github Models API calls. It would be nice to have the support for Github models, as they're free to use (if you get your access granted) and gives you free API key to request differents models, GPT 4o included

Suggested Solution

The user could provide a GITHUB_TOKEN (free) instead of the OpenAI (not free) API key for the LLM requests.

Usage :

import os
from openai import OpenAI

token = os.environ["GITHUB_TOKEN"]
endpoint = "https://models.inference.ai.azure.com"
model_name = "gpt-4o-mini"

client = OpenAI(
    base_url=endpoint,
    api_key=token,
)

response = client.chat.completions.create(
    messages=[
        {
            "role": "system",
            "content": "You are in charge to create a commit name for all those differences:",
        },
        {
            "role": "user",
            "content": "What is the capital of France?",
        }
    ],
    model=model_name,
    temperature=1.,
    max_tokens=1000,
    top_p=1.
)

print(response.choices[0].message.content)
Alternatives

No response

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 how opencommit currently configures OpenAI and other LLM providers, then compare those requests with the GitHub Models example in the issue. Define how GITHUB_TOKEN, the models.inference.ai.azure.com endpoint, and model selection should be exposed. Done means GitHub Models requests work without an OpenAI API key and are covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, javascript
Domain
ai, api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.