mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
feat: add GLM/alternative API support via environment variables
Add support for using alternative API endpoints (like Zhipu AI's GLM models) without affecting the user's global Claude Code settings. Configuration is done via AutoCoder's .env file. Changes: - Add API_ENV_VARS constant and pass through ClaudeAgentOptions.env parameter in client.py and all server service files (spec, expand, assistant sessions) - Add glm_mode to settings API response to indicate when GLM is configured - Add purple "GLM" badge in UI header when GLM mode is active - Update setup status to accept GLM credentials as valid authentication - Update .env.example with GLM configuration documentation - Update README.md with AutoCoder-scoped GLM setup instructions Supported environment variables: - ANTHROPIC_BASE_URL: Custom API endpoint (e.g., https://api.z.ai/api/anthropic) - ANTHROPIC_AUTH_TOKEN: API authentication token - API_TIMEOUT_MS: Request timeout in milliseconds - ANTHROPIC_DEFAULT_SONNET_MODEL: Model override for Sonnet - ANTHROPIC_DEFAULT_OPUS_MODEL: Model override for Opus - ANTHROPIC_DEFAULT_HAIKU_MODEL: Model override for Haiku This approach routes API requests through the alternative endpoint while keeping all Claude Code features (MCP servers, hooks, permissions) intact. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { useProjects, useFeatures, useAgentStatus } from './hooks/useProjects'
|
||||
import { useProjects, useFeatures, useAgentStatus, useSettings } from './hooks/useProjects'
|
||||
import { useProjectWebSocket } from './hooks/useWebSocket'
|
||||
import { useFeatureSound } from './hooks/useFeatureSound'
|
||||
import { useCelebration } from './hooks/useCelebration'
|
||||
@@ -46,6 +46,7 @@ function App() {
|
||||
const queryClient = useQueryClient()
|
||||
const { data: projects, isLoading: projectsLoading } = useProjects()
|
||||
const { data: features } = useFeatures(selectedProject)
|
||||
const { data: settings } = useSettings()
|
||||
useAgentStatus(selectedProject) // Keep polling for status updates
|
||||
const wsState = useProjectWebSocket(selectedProject)
|
||||
|
||||
@@ -210,6 +211,16 @@ function App() {
|
||||
>
|
||||
<Settings size={18} />
|
||||
</button>
|
||||
|
||||
{/* GLM Mode Badge */}
|
||||
{settings?.glm_mode && (
|
||||
<span
|
||||
className="px-2 py-1 text-xs font-bold bg-purple-500 text-white rounded border-2 border-black shadow-neo-sm"
|
||||
title="Using GLM API (configured via .env)"
|
||||
>
|
||||
GLM
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user