AI Providers
This document describes provider-specific behavior and options implemented in indusagi/src/ai/providers/*.
Environment Variables
These are read by getEnvApiKey in indusagi/src/ai/env-api-keys.ts.
OPENAI_API_KEYfor provideropenaiAZURE_OPENAI_API_KEYfor providerazure-openai-responsesGEMINI_API_KEYfor providergoogleGROQ_API_KEYfor providergroqCEREBRAS_API_KEYfor providercerebrasXAI_API_KEYfor providerxaiOPENROUTER_API_KEYfor provideropenrouterAI_GATEWAY_API_KEYfor providervercel-ai-gatewayZAI_API_KEYfor providerzaiMISTRAL_API_KEYfor providermistralMINIMAX_API_KEYfor providerminimaxMINIMAX_CN_API_KEYfor providerminimax-cnOPENCODE_API_KEYfor provideropencodeCOPILOT_GITHUB_TOKENorGH_TOKENorGITHUB_TOKENfor providergithub-copilotANTHROPIC_OAUTH_TOKENorANTHROPIC_API_KEYfor provideranthropic
Google Vertex uses Application Default Credentials and requires:
GOOGLE_APPLICATION_CREDENTIALSor the default ADC file in~/.config/gcloud/application_default_credentials.jsonGOOGLE_CLOUD_PROJECTorGCLOUD_PROJECTGOOGLE_CLOUD_LOCATION
Amazon Bedrock uses standard AWS auth sources:
AWS_PROFILEorAWS_ACCESS_KEY_IDplusAWS_SECRET_ACCESS_KEYAWS_BEARER_TOKEN_BEDROCKAWS_CONTAINER_CREDENTIALS_RELATIVE_URIorAWS_CONTAINER_CREDENTIALS_FULL_URIAWS_WEB_IDENTITY_TOKEN_FILE
OpenAI Completions (`openai-completions`)
Implementation: providers/openai-completions.ts
Options:
toolChoice?: "auto" | "none" | "required" | { type: "function"; function: { name: string } }reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh"
Highlights:
- Supports images via
contentparts when model allowsinput: ["text", "image"]. - Handles tool calls and tool results, including providers that require special tool call IDs.
- Supports provider compatibility overrides via
model.compat. - Adds OpenRouter Anthropic cache control to the last user or assistant text block.
Compatibility overrides for model.compat include:
supportsStore,supportsDeveloperRole,supportsReasoningEffortsupportsUsageInStreaming,maxTokensFieldrequiresToolResultName,requiresAssistantAfterToolResultrequiresThinkingAsText,requiresMistralToolIdsthinkingFormat,openRouterRouting
OpenAI Responses (`openai-responses`)
Implementation: providers/openai-responses.ts and providers/openai-responses-shared.ts
Options:
reasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh"reasoningSummary?: "auto" | "detailed" | "concise" | nullserviceTier?: "auto" | "flex" | "priority"
Highlights:
- Uses the Responses API and
processResponsesStreamfor event handling. - Applies service tier cost multipliers for
flexandprioritytiers. - When reasoning is disabled on some GPT-5 models, it injects
# Juice: 0 !importantto disable reasoning.
Azure OpenAI Responses (`azure-openai-responses`)
Implementation: providers/azure-openai-responses.ts
Options:
azureApiVersion?: stringazureResourceName?: stringazureBaseUrl?: stringazureDeploymentName?: stringreasoningEffort?: "minimal" | "low" | "medium" | "high" | "xhigh"reasoningSummary?: "auto" | "detailed" | "concise" | null
Environment variables:
AZURE_OPENAI_BASE_URLAZURE_OPENAI_RESOURCE_NAMEAZURE_OPENAI_API_VERSIONAZURE_OPENAI_DEPLOYMENT_NAME_MAP(comma separatedmodelId=deploymentNamepairs)
OpenAI Codex Responses (`openai-codex-responses`)
Implementation: providers/openai-codex-responses.ts
Options:
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh"reasoningSummary?: "auto" | "concise" | "detailed" | "off" | "on" | nulltextVerbosity?: "low" | "medium" | "high"
Highlights:
- Uses ChatGPT Codex endpoint with SSE parsing and retry logic.
- Requires a JWT access token, with account ID extracted from the token payload.
- Supports
sessionIdwhich maps toprompt_cache_key.
Anthropic Messages (`anthropic-messages`)
Implementation: providers/anthropic.ts
Options:
thinkingEnabled?: booleanthinkingBudgetTokens?: numberinterleavedThinking?: booleantoolChoice?: "auto" | "any" | "none" | { type: "tool"; name: string }
Highlights:
- Supports both API keys and OAuth tokens.
- When using OAuth tokens, it mimics Claude Code headers and tool naming.
- Supports tool calls, tool results, and image inputs.
Amazon Bedrock (`bedrock-converse-stream`)
Implementation: providers/amazon-bedrock.ts
Options:
region?: stringprofile?: stringtoolChoice?: "auto" | "any" | "none" | { type: "tool"; name: string }reasoning?: ThinkingLevelthinkingBudgets?: ThinkingBudgetsinterleavedThinking?: boolean
Highlights:
- Uses AWS SDK
ConverseStreamCommand. - Supports tool calls and tool results in a single user message (Bedrock requirement).
- Adds prompt caching blocks for supported Claude models.
- Handles model-specific support for reasoning signatures.
Google Generative AI (`google-generative-ai`)
Implementation: providers/google.ts and providers/google-shared.ts
Options:
toolChoice?: "auto" | "none" | "any"thinking?: { enabled: boolean; budgetTokens?: number; level?: GoogleThinkingLevel }
Highlights:
- Supports text and image input.
- Uses thought signatures for reasoning and tool calls when available.
- Distinguishes Gemini 3 models that require
thinkingLevelinstead ofthinkingBudget.
Google Vertex (`google-vertex`)
Implementation: providers/google-vertex.ts and providers/google-shared.ts
Options:
project?: stringlocation?: stringtoolChoice?: "auto" | "none" | "any"thinking?: { enabled: boolean; budgetTokens?: number; level?: GoogleThinkingLevel }
Highlights:
- Uses Vertex AI configuration with project and location.
- Uses the same message conversion and tool handling as
google-generative-ai.
Google Gemini CLI / Antigravity (`google-gemini-cli` and `google-antigravity`)
Implementation: providers/google-gemini-cli.ts plus OAuth providers in utils/oauth.
Options:
projectId?: stringtoolChoice?: "auto" | "none" | "any"thinking?: { enabled: boolean; budgetTokens?: number; level?: GoogleThinkingLevel }
Highlights:
- Uses Cloud Code Assist endpoint and requires OAuth credentials.
- Supports both Gemini CLI and Antigravity endpoints with retry logic.
- Injects system instructions for Antigravity and supports thought signatures.
OpenAI-Compatible Providers
The OpenAI Completions provider handles compatibility for multiple non-OpenAI backends.
Providers include openrouter, xai, groq, cerebras, mistral, zai, and opencode.
Compatibility is auto-detected from provider and baseUrl, or overridden via model.compat.
