Skip to main content

A Python package to interact with GitHub AI models.

Project description

GithubAIPy

They released this recently, so why not make a wrapper of it, to use everywhere !

A Python package to interact with GitHub AI models. Easily authenticate and query AI models using a simple and intuitive interface.

Installation

Install the package via pip:

pip install GithubAIPy

Quick Guide: Get GitHub Bearer Token Using Chrome DevTools

Go to: https://github.com/marketplace/models/azure-openai/gpt-4o/playground.

Open DevTools: F12 → Network tab.

Send a message in the playground.

In DevTools, find the completions request → check Headers → copy the Authorization: Bearer value.

⚠️ Warning: Keep your token private!

To use it, just put the full cookie with bearer before !

Usage

Authentication

authenticate using your GitHub Bearer token:

from GithubAIPy import login

login("your_bearer_token_here")

Querying a Model

Use the ask function to send a query to a specific AI model:

from GithubAIPy import ask

response = ask("Meta-Llama-3-70B-Instruct", "What is the capital of France?")
print(response)

Streaming Responses

Ask function supports streaming responses for real-time interaction:

response = ask("Meta-Llama-3-70B-Instruct", "Explain quantum computing in simple terms.", stream=True)

Supported AI Models

Below is a list of supported AI models. You can use any of these models with the ask function.

Supported AI Models

Below is a list of supported AI models. You can use any of these models with the ask function.

Model Name
gpt-4o gpt-4o-mini o1-mini
o1-preview o3-mini text-embedding-3-large
text-embedding-3-small Phi-3.5-MoE-instruct Phi-3.5-mini-instruct
Phi-3.5-vision-instruct Phi-3-medium-128k-instruct Phi-3-medium-4k-instruct
Phi-3-mini-128k-instruct Phi-3-mini-4k-instruct Phi-3-small-128k-instruct
Phi-3-small-8k-instruct Phi-4 AI21-Jamba-1.5-Large
AI21-Jamba-1.5-Mini Codestral-2501 Cohere-command-r
Cohere-command-r-08-2024 Cohere-command-r-plus Cohere-command-r-plus-08-2024
Cohere-embed-v3-english Cohere-embed-v3-multilingual DeepSeek-R1
Llama-3.2-11B-Vision-Instruct Llama-3.2-90B-Vision-Instruct Llama-3.3-70B-Instruct
Meta-Llama-3.1-405B-Instruct Meta-Llama-3.1-70B-Instruct Meta-Llama-3.1-8B-Instruct
Meta-Llama-3-70B-Instruct Meta-Llama-3-8B-Instruct Ministral-3B
Mistral-Large-2411 Mistral-Nemo Mistral-large
Mistral-large-2407 Mistral-small jais-30b-chat

Examples

Example 1: Simple Query

response = ask("gpt-4o", "What is the meaning of life?")
print(response)

Example 2: Streaming Response

response = ask("Meta-Llama-3-70B-Instruct", "Explain the theory of relativity.", stream=True)

Example 3: Using a Different Model

response = ask("Mistral-Large-2411", "Write a Python function to calculate the Fibonacci sequence.")
print(response)

Contributing

Contributions are welcome! If you'd like to contribute, please follow these steps:

Fork the repository.

Create a new branch (git checkout -b feature/YourFeatureName).

Commit your changes (git commit -m 'Add some feature').

Push to the branch (git push origin feature/YourFeatureName).

Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support For issues or feature requests, please open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GithubAIPy-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GithubAIPy-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file GithubAIPy-0.1.1.tar.gz.

File metadata

  • Download URL: GithubAIPy-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for GithubAIPy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c334d5dc84ac6940231c5de56602316db478d3821cf4755eba0f65469cafa5ac
MD5 289f36457f1e37e0c2282197db319a94
BLAKE2b-256 f3c96c396ce1d2ea7b49b4e256db69455dfb61c8b0f2ddd31b6562ac23215a97

See more details on using hashes here.

File details

Details for the file GithubAIPy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: GithubAIPy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for GithubAIPy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8fc0303069bb78bb61e960c1fc13f819c773b13e8d91d8254b94542b436705a7
MD5 279da05ee061a9ed51a56c4a0c60c5e8
BLAKE2b-256 2bea2e43a9e2b5c18ae4b271d5d81e66f9b785855d07efe926f6f87ed8357d7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page