Skip to content

API Service Related Configuration

While api-server.js prioritizes reading configurations from command-line arguments, it also supports loading default values from a config.json file (if present). Below are key configuration items related to the API service and their descriptions:

Parameter NameDescriptionDefault Value
REQUIRED_API_KEYThe key required for clients to access the API."123456"
SERVER_PORTThe port on which the API service listens.3000
HOSTThe address on which the API service listens."localhost"
MODEL_PROVIDERThe AI model provider. Optional values include:
- gemini-cli-oauth: Uses Google Gemini CLI authentication.
- openai-custom: Uses OpenAI compatible API.
- claude-custom: Uses Claude compatible API.
- kiro-api: Uses Kiro/CodeWhisperer to access Claude.
"gemini-cli-oauth"
OPENAI_API_KEYOpenAI API key when MODEL_PROVIDER is openai-custom.null
OPENAI_BASE_URLOpenAI API base URL when MODEL_PROVIDER is openai-custom.null
CLAUDE_API_KEYClaude API key when MODEL_PROVIDER is claude-custom.null
CLAUDE_BASE_URLClaude API base URL when MODEL_PROVIDER is claude-custom.null
GEMINI_OAUTH_CREDS_BASE64Base64 string of Gemini OAuth credentials when MODEL_PROVIDER is gemini-cli-oauth.null
GEMINI_OAUTH_CREDS_FILE_PATHPath to the Gemini OAuth credentials JSON file when MODEL_PROVIDER is gemini-cli-oauth.null
KIRO_OAUTH_CREDS_BASE64Base64 string of Kiro OAuth credentials when MODEL_PROVIDER is kiro-api.null
KIRO_OAUTH_CREDS_FILE_PATHPath to the Kiro OAuth credentials JSON file when MODEL_PROVIDER is kiro-api.null
PROJECT_IDGoogle Cloud Project ID when MODEL_PROVIDER is gemini-cli-oauth.null
SYSTEM_PROMPT_FILE_PATHPath to the file containing system prompts."input_system_prompt.txt"
SYSTEM_PROMPT_MODESystem prompt processing mode: overwrite or append."overwrite"
PROMPT_LOG_BASE_NAMEBase name for prompt log files."prompt_log"
PROMPT_LOG_MODEPrompt log mode: console, file, or none."none"
REQUEST_MAX_RETRIESMaximum number of retries for API requests upon failure.3
REQUEST_BASE_DELAYBase delay time (in milliseconds) for API request retries, which increases exponentially with each retry.1000
CRON_NEAR_MINUTESThe number of minutes before token expiration to trigger a refresh.5
CRON_REFRESH_TOKENWhether to enable automatic token refresh.true

Example config.json (can be placed in the project root directory):

json
{
  "REQUIRED_API_KEY": "my_super_secret_key",
  "SERVER_PORT": 8005,
  "HOST": "127.0.0.1",
  "MODEL_PROVIDER": "gemini-cli-oauth",
  "GEMINI_OAUTH_CREDS_FILE_PATH": "/path/to/credentials.json",
  "PROJECT_ID": "your-gcp-project-id",
  "SYSTEM_PROMPT_FILE_PATH": "./custom_system_prompt.txt",
  "SYSTEM_PROMPT_MODE": "append",
  "PROMPT_LOG_MODE": "file",
  "PROMPT_LOG_BASE_NAME": "aiclient_2_api_logs",
  "REQUEST_MAX_RETRIES": 5,
  "REQUEST_BASE_DELAY": 2000,
  "CRON_NEAR_MINUTES": 5,
  "CRON_REFRESH_TOKEN": true
}

By appropriately configuring config.json, you can finely control the behavior of AIClient-2-API to better suit your needs and hardware environment.