← Back to the README · Icon guide · Feature graphic guide
SnapAI calls OpenAI or Google directly. It does not use a SnapAI backend, and it only needs the API key for the provider you choose.
Store keys in ~/.snapai/config.json:
snapai config --openai-api-key "sk-your-openai-api-key"
snapai config --google-api-key "your-google-ai-studio-key"
snapai config --showconfig --show masks saved API keys.
Environment variables are a better fit for CI and other temporary environments:
export SNAPAI_API_KEY="sk-..."
export SNAPAI_GOOGLE_API_KEY="..."The provider-specific names are also supported:
export OPENAI_API_KEY="sk-..."
export GEMINI_API_KEY="..."Pass a key for one command without writing it to disk:
npx snapai icon \
--openai-api-key "sk-..." \
--prompt "modern app artwork"
npx snapai icon \
--model banana \
--google-api-key "..." \
--prompt "modern app artwork"SnapAI resolves credentials in this order:
| Provider | Highest to lowest priority |
|---|---|
| OpenAI | --openai-api-key → SNAPAI_API_KEY → OPENAI_API_KEY → local config |
--google-api-key → SNAPAI_GOOGLE_API_KEY → GEMINI_API_KEY → local config |
Point the OpenAI client at a compatible proxy, gateway, or local service:
snapai config --openai-base-url "https://my-proxy.example.com/v1"Or set an environment variable, which takes precedence over local configuration:
export OPENAI_BASE_URL="https://my-proxy.example.com/v1"To return to the default OpenAI endpoint, remove openai_base_url from ~/.snapai/config.json.
Compatibility depends on whether the endpoint implements the image generation API and parameters used by the selected model.
Store your API key as a repository secret, then expose it only to the generation step:
- name: Generate app icon
run: >
npx snapai icon
--prompt "minimalist weather app with sun and cloud"
--output ./assets/icons
env:
SNAPAI_API_KEY: ${{ secrets.SNAPAI_API_KEY }}The same pattern works with SNAPAI_GOOGLE_API_KEY and a Gemini model.
- SnapAI ships without telemetry or analytics.
- Prompts and images go directly between your machine and the selected provider.
- SnapAI does not run a backend and does not collect your prompts or generated files.
- Keys are only stored when you run
snapai config .... - Never commit API keys or
~/.snapai/config.jsonto Git.
See the CLI reference for all configuration flags.