Skip to main content

GITHAI CLI

A CLI tool that combines GitHub's API with the LLM API to help you understand, analyze, and work with GitHub repositories and issues more effectively.

Quick Start

# Install the CLI
pip install githai

# Set up your GitHub token (required for GitHub API access)
ghai keys set GITHUB_TOKEN

# Analyze a GitHub issue with AI
ghai explain-issue --issue-url https://github.com/owner/repo/issues/123

# List available commands
ghai --help

API Keys and Model Configuration

GHAI supports multiple AI models from different providers. You can configure API keys for the following services:

Supported Models and Keys

  • GitHub Models

    • github/gpt-4o-mini
    • github/claude-3-haiku
    • etc...
    • Requires: GITHUB_TOKEN
  • OpenAI Models

    • gpt-4
    • gpt-3.5-turbo
    • etc...
    • Requires: OPENAI_API_KEY
  • Anthropic Models

    • claude-3-sonnet
    • claude-3-haiku
    • etc...
    • Requires: ANTHROPIC_API_KEY

Setting API Keys

# GitHub token (required for all GitHub API access)
ghai keys set GITHUB_TOKEN

# OpenAI API key (for OpenAI models)
ghai keys set OPENAI_API_KEY

# Anthropic API key (for Anthropic models)
ghai keys set ANTHROPIC_API_KEY

# List all stored keys
ghai keys list

# Show the path to your keys file
ghai keys path

Default Model Configuration

Set a default model to use across all commands:

# Set default model (recommended: use free GitHub models)
ghai keys set-default-model github/gpt-4o-mini

# View current default model
ghai keys get-default-model

# Clear default model setting
ghai keys clear-default-model

If no default model is set, commands will use their built-in defaults.

Key Management

# Delete a specific key
ghai keys delete OPENAI_API_KEY

# View all available key management commands
ghai keys --help

Example Commands and Usage

Explain Issue

Analyze GitHub issues with AI to get detailed explanations, context, and insights:

# Analyze a GitHub issue using the default prompt
ghai explain-issue --issue-url https://github.com/owner/repo/issues/123

# Use a custom prompt file
ghai explain-issue --issue-url https://github.com/owner/repo/issues/123 --prompt custom_prompt.md

# Short form
ghai explain-issue -u https://github.com/owner/repo/issues/123 -p custom_prompt.md

Progress Update

Get progress updates on GitHub issues and their related sub-issues:

# Get progress update using default prompt
ghai progress-update --issue-url https://github.com/owner/repo/issues/123

# Use a custom prompt file
ghai progress-update --issue-url https://github.com/owner/repo/issues/123 --prompt progress_prompt.md

# Short form
ghai progress-update -u https://github.com/owner/repo/issues/123 -p progress_prompt.md

Custom Prompts

Most commands support custom prompts to tailor the AI analysis to your specific needs.

Using Custom Prompts

  1. Create your prompt file in Markdown format
  2. Use the --prompt option with any command:
    ghai explain-issue -u <issue-url> --prompt your-custom-prompt.md
    
  3. Path resolution: Prompts can be specified with:
    • Absolute paths: /full/path/to/prompt.md
    • Relative paths: ./prompts/custom.md

Use prompt best practices.

Project Structure

ghai/
├── src/
│   └── ghai/
│       ├── __init__.py
│       ├── cli.py              # Main CLI entry point
│       ├── github_api.py       # GitHub GraphQL API client
│       ├── llm_api.py          # AI/LLM integration
│       ├── commands/           # Command modules
│       │   ├── __init__.py
│       │   ├── explain_issue.py    # Issue analysis command
│       │   ├── snippet_update.py   # Code snippet updates
│       │   ├── progress_update.py  # Progress reporting
│       │   └── keys.py             # Key management
│       ├── types/              # Type definitions
│       │   └── github_api_types.py
│       └── util/
│           ├── __init__.py
│           └── key_util.py  # Key utility functions
├── prompts/                    # AI prompt templates
│   ├── explain_issue_prompt.md
│   ├── initiative_prompt.md
│   └── snippet_prompt.md
├── pyproject.toml
└── README.md

License

MIT License

Metadata

Release files for githai 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for githai 0.1.1
File Size Uploaded Provenance Actions
githai-0.1.1.tar.gz 18.3 kB Without provenance Details for githai-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for githai 0.1.1
File Interpreter ABI Platform Actions
githai-0.1.1-py3-none-any.whl Python 3 none any Details for githai-0.1.1-py3-none-any.whl

Total release size: 39.7 kB

Release files / githai-0.1.1.tar.gz

Download URL githai-0.1.1.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0c46886bac2caac316d1287c6742c5687d8f8cb99cbff6996f0f61dc385583ca
BLAKE2b-256 checksum
How to use checksums
51356e3e3575dbb71c86ed710541b3c8cef8fd8330d9269c147079c76bce4f38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / githai-0.1.1-py3-none-any.whl

Download URL githai-0.1.1-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38057160f8e7f0cbce0a4e9dfcc7c070dd61a36633ae1359fa295b6f3ee95059
BLAKE2b-256 checksum
How to use checksums
8056a98e9c5cfeefab8dfed1a0f3ae5d50ceb175f26665442a1b1ead914fffb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for githai 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page