genaiscript icon indicating copy to clipboard operation
genaiscript copied to clipboard

Use GH Copilot Model in command line

Open lushevol opened this issue 10 months ago • 7 comments

Hi, thanks for this awesome GenAI tool, I'm a big fan of it! I got problem when using it, the company only provides github copilot to us, no other LLMs internal/external allowed.

When using GenAI in vscode, I can only run it with VSCODE gui like right menu "run GenAiScript" or GenAI icon on scripts, can't access GenAI in terminal.

Is there anyway to run scripts in such situation? It's realy not so good without cli option.

Looking forward to your reply, thanks again for your awesome work!

lushevol avatar May 10 '25 00:05 lushevol

Have you considered using https://microsoft.github.io/genaiscript/getting-started/configuration/#github-models ? The GitHub copilot chat models will only work from vscode.

pelikhan avatar May 10 '25 11:05 pelikhan

Hi pelikhan, thank you for replying. The company provides enterprise github copilot accounts to us, so I'm using github copilot chat model in GenAIScript, with config like "github_copilot_chat:gpt-4o", which is working with vscode gui accessing. Do you mean that I can try github model instead? a little bit confusing with their differences. I thought GenAIScript is running service in vscode env so it can connect to its LLM, so the problem is terminals can't access to vscode runtime directly. Am I right? Sorry for the stupid question and thanks again for your reply.

lushevol avatar May 10 '25 13:05 lushevol

And we don't have github copilot key or token, the only way I can is from Vscode LM API...

lushevol avatar May 10 '25 13:05 lushevol

The GenAIScript cli can connect to various LLM providers, including GitHub Models (https://github.com/marketplace/models). If you have a GitHub account, you have access to GitHub Models with rate limiting. In that case, it is just a REST API call to the models endpoint.

When the extension is running, it also add support for Github Copilot Chat Models but this is only available from the VSCode extension as it goes through VS code extensibility APIs.

pelikhan avatar May 10 '25 13:05 pelikhan

Do you have access to codespaces or GitHub actions?

pelikhan avatar May 10 '25 15:05 pelikhan

I checked with our GHCP plan, codespaces is disabled and action is available. When I trying to change to github model I found models.inference.ai.azure.com is blocked from terminal. Anyway thanks for helping me on the issue, seems command line usage still a long way to troubleshooting.

Thank you!

lushevol avatar May 12 '25 04:05 lushevol

To access GitHub Models out side of a codespace, you would have a create a new developer token with models: read scope.

https://github.com/settings/personal-access-tokens/new

Then store it as GITHUB_TOKEN=... in your .env file.

pelikhan avatar May 12 '25 15:05 pelikhan

Summary:

A user wants to use the GenAIScript tool with GitHub Copilot model from the command line, but their company only allows access to GitHub Copilot (no other LLMs or keys/tokens). The GenAIScript extension works inside VSCode GUI (using "Run GenAiScript" from menus), but not from the terminal/CLI. The user is unsure if switching from Copilot Chat to "GitHub Model" in configuration can help, and notes they can't access Copilot outside of VSCode, nor do they have Copilot tokens, only VSCode Copilot access.

The project maintainer explains:

  • GitHub Copilot Chat models work inside VSCode only (via VSCode APIs), not CLI.
  • GenAIScript CLI can access various LLM providers, including "GitHub Models" via REST API, given a personal access token.
  • GitHub Models (marketplace) require a token with models: read scope for direct API/CLI access, which the user lacks, and terminal access to the Azure inference endpoint is blocked by company policy.
  • Codespaces are disabled, but GitHub Actions are available.

Key Point:
There is no way to use Copilot Chat models from the CLI due to how access is implemented; the only option for CLI is using "GitHub Models" with a personal access token—which the user cannot use because of company restrictions. The GUI access in VSCode remains the only working method for now.

AI-generated content by issue-bot may be incorrect. Use reactions to eval.

github-actions[bot] avatar Jun 08 '25 03:06 github-actions[bot]