This guide will he### 5. Available Models
The following models are available through GitHub Models API:
-
GPT Models:
gpt-4o- Latest GPT-4 Omni modelgpt-4o-mini- Smaller, faster GPT-4 variant (recommended for development)
-
OpenAI o1 Models:
o1-preview- Preview of reasoning modelo1-mini- Smaller reasoning model
-
Claude Models:
claude-3-5-sonnet- Anthropic's Claude 3.5 Sonnetclaude-3-haiku- Faster Claude variant
Note: Model names should be used without the provider prefix (e.g., use gpt-4o-mini not openai/gpt-4o-mini)
- A GitHub account
- Access to GitHub Models (currently in preview)
- Node.js and npm installed
- Visit GitHub Models
- Sign up for the preview program if you haven't already
- Wait for approval (this may take some time as it's currently in preview)
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token" → "Generate new token (classic)"
- Give your token a descriptive name (e.g., "Zenify Chat API")
- Set an appropriate expiration date
- Select the following scopes:
repo(if your repo is private)model(for GitHub Models access)
- Click "Generate token"
- Important: Copy the token immediately as you won't be able to see it again
The project uses the Azure REST client for GitHub Models API:
npm install @azure-rest/ai-inference @azure/core-auth-
Copy
.env.exampleto.env:cp .env.example .env
-
Edit the
.envfile and replace the placeholder values:VITE_GITHUB_API_TOKEN=your_actual_github_token_here VITE_GITHUB_MODEL=gpt-4o-mini
The following models are available through GitHub Models API:
-
GPT Models:
gpt-4o- Latest GPT-4 Omni modelgpt-4o-mini- Smaller, faster GPT-4 variant (recommended for development)
-
OpenAI o1 Models:
o1-preview- Preview of reasoning modelo1-mini- Smaller reasoning model
-
Claude Models:
claude-3-5-sonnet- Anthropic's Claude 3.5 Sonnetclaude-3-haiku- Faster Claude variant
-
Start the development server:
npm run dev
-
Navigate to the Chat page
-
Send a test message
-
Verify that you receive responses from the AI model
-
"GitHub API token is missing" error:
- Ensure your
.envfile exists and contains the correct token - Verify the token has the
modelscope enabled - Restart the development server after changing environment variables
- Ensure your
-
Rate limiting:
- GitHub Models has rate limits that vary by model
- Consider using
gpt-4o-minifor development to conserve rate limits
-
Model not available:
- Ensure you have access to GitHub Models preview
- Some models may have restricted access
If you encounter issues:
- Check the browser console for detailed error messages
- Verify your GitHub Models access status
- Ensure your personal access token has the correct permissions
- Try switching to a different model (e.g.,
gpt-4o-mini)
- Never commit your actual API token to version control
- Use environment variables for all sensitive configuration
- Regularly rotate your personal access tokens
- Consider using GitHub Apps for production deployments