Skip to main content

Simple Python client for GitHub Models API

Project description

gfmodel

A simple Python client for the GitHub Models API. This package provides an easy-to-use interface to interact with GitHub's free, OpenAI-compatible inference API, allowing you to integrate large language models into your projects with a GitHub Personal Access Token (PAT) instead of a paid API key.

Installation

The package requires requests as a dependency. You can install it from PyPI using pip:

pip install gfmodel

Features

  • Easy Authentication: Log in with a GitHub Personal Access Token (PAT).
  • OpenAI Compatibility: Utilizes an OpenAI-compatible chat/completions endpoint.
  • Simple Interface: Methods to log in, set a model, and interact with the model via a simple chat function.

Usage

Here is a basic example of how to use the gfmodel client to chat with a model.

First, ensure you have a GitHub Personal Access Token with the models:read scope.

import gfmodel

# Replace with your actual GitHub PAT.
# You can also set this as a GITHUB_TOKEN environment variable.
gfmodel.login("YOUR_GITHUB_ACCESS_TOKEN")

# Get a list of all available models
gfmodel.show()

# Set the model to use.
gfmodel.set("openai/gpt-4o")

# Start a chat.
response = gfmodel.chat("Hello!")
print(response)

Available Models (as of 08/09/2025)

- openai/gpt-4.1
- openai/gpt-4.1-mini
- openai/gpt-4.1-nano
- openai/gpt-4o
- openai/gpt-4o-mini
- openai/gpt-5
- openai/gpt-5-chat
- openai/gpt-5-mini
- openai/gpt-5-nano
- openai/o1
- openai/o1-mini
- openai/o1-preview
- openai/o3
- openai/o3-mini
- openai/o4-mini
- openai/text-embedding-3-large
- openai/text-embedding-3-small
- ai21-labs/ai21-jamba-1.5-large
- ai21-labs/ai21-jamba-1.5-mini
- cohere/cohere-command-a
- cohere/cohere-command-r-08-2024
- cohere/cohere-command-r-plus-08-2024
- cohere/cohere-embed-v3-english
- cohere/cohere-embed-v3-multilingual
- core42/jais-30b-chat
- deepseek/deepseek-r1
- deepseek/deepseek-r1-0528
- deepseek/deepseek-v3-0324
- meta/llama-3.2-11b-vision-instruct
- meta/llama-3.2-90b-vision-instruct
- meta/llama-3.3-70b-instruct
- meta/llama-4-maverick-17b-128e-instruct-fp8
- meta/llama-4-scout-17b-16e-instruct
- meta/meta-llama-3.1-405b-instruct
- meta/meta-llama-3.1-8b-instruct
- mistral-ai/codestral-2501
- mistral-ai/ministral-3b
- mistral-ai/mistral-large-2411
- mistral-ai/mistral-medium-2505
- mistral-ai/mistral-nemo
- mistral-ai/mistral-small-2503
- xai/grok-3
- xai/grok-3-mini
- microsoft/mai-ds-r1
- microsoft/phi-3.5-mini-instruct
- microsoft/phi-3.5-moe-instruct
- microsoft/phi-3.5-vision-instruct
- microsoft/phi-3-medium-128k-instruct
- microsoft/phi-3-medium-4k-instruct
- microsoft/phi-3-mini-128k-instruct
- microsoft/phi-3-mini-4k-instruct
- microsoft/phi-3-small-128k-instruct
- microsoft/phi-3-small-8k-instruct
- microsoft/phi-4
- microsoft/phi-4-mini-instruct
- microsoft/phi-4-mini-reasoning
- microsoft/phi-4-multimodal-instruct
- microsoft/phi-4-reasoning

Project Details

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

gfmodel-1.0.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

gfmodel-1.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file gfmodel-1.0.0.tar.gz.

File metadata

  • Download URL: gfmodel-1.0.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for gfmodel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 83bdb672d412d87ada1154e6f8f69cfe86b9fc4818ee093b656cb64a7de5ceff
MD5 03e222b2f98b3f257da9ec0cef0bdc14
BLAKE2b-256 0473707242831845eccba4782ad33557c7e9163971e16122087f3e265f3141d0

See more details on using hashes here.

File details

Details for the file gfmodel-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gfmodel-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for gfmodel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e71b1c6dcf9ce7affd416607747d5834bcb3194866bb1d00ecd64dc9e4fe0f0
MD5 fa8d5e1763bf160f015b67a94a060b20
BLAKE2b-256 da700be5347a938d8d4e492b6c27255e5979ada2033c01a7473c03060f9c7732

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