Skip to content

Latest commit

 

History

History
246 lines (165 loc) · 5.58 KB

File metadata and controls

246 lines (165 loc) · 5.58 KB

Configuration Guide

This document describes the available configuration and authentication methods supported by WebAI-to-API.

Authentication Priority

When initializing the Gemini backend, WebAI-to-API searches for authentication material in the following priority order:

  1. config.conf ([Gemini] section): Explicitly configured cookies.
  2. config.conf ([Cookies] section): Legacy/deprecated cookie configuration.
  3. runtime/auth/gemini.json: Persistence state generated by verify_login.py.
  4. Browser Discovery: Automatic cookie retrieval from local browser profiles (host-only).

Authentication Methods

WebAI-to-API supports multiple authentication approaches depending on the selected backend and deployment environment.

Method A: Manual Cookies (Gemini WebAPI)

Configure Gemini authentication directly in config.conf:

[Gemini]
secure_1psid =
secure_1psidts =

Advantages

  • Works in Docker and host environments
  • No browser automation required
  • Quick setup

Recommended For

  • Gemini WebAPI deployments
  • Headless environments
  • Simple installations

Method B: Browser Login (Playwright)

Generate browser authentication state:

poetry run python verify_login.py

This creates:

runtime/auth/gemini.json

Advantages

  • Native browser authentication
  • Persistent login state
  • Recommended Playwright workflow

Recommended For

  • Playwright backend
  • Docker + Playwright deployments
  • Long-lived authenticated sessions

Method C: Browser Cookie Discovery

WebAI-to-API can automatically retrieve cookies from supported browsers when explicit credentials are not provided.

Supported browsers depend on the local environment and available browser profiles.


Authentication Comparison

Method Backend Docker Persistence
Manual Cookies WebAPI Yes Cookie lifetime
verify_login.py Playwright Yes Persistent
Browser Discovery WebAPI Host Only Cookie lifetime
/v1/auth/login Playwright Host Only Persistent

Playwright Setup

Install Playwright browser binaries:

poetry run playwright install chromium

Generate authentication:

poetry run python verify_login.py

Verify status:

curl http://localhost:6969/v1/auth/status

Basic Configuration

Example:

[Gemini]
backend = webapi
default_model = gemini-3-flash

[EnabledAI]
gemini = true

[Browser]
name = firefox

[Proxy]
http_proxy =

Key Configuration Options

Gemini

Option Description
backend Execution backend (webapi or playwright)
default_model Default Gemini model

Supported Cookie Keys (in [Gemini] section)

The following keys are accepted for manual cookie configuration:

  • __Secure-1PSID / __Secure-1PSIDTS (Canonical)
  • gemini_cookie_1psid / gemini_cookie_1psidts (Supported)

Warning

The [Cookies] configuration section is legacy and deprecated. Please move your cookies to the [Gemini] section.

Atlas Cloud

Option Description
api_key Atlas Cloud API key
base_url Atlas Cloud API base address

Note

Atlas models are only advertised when Atlas is configured with a valid API key. If Atlas is not configured, Atlas models will not appear in the model catalog or dashboard UI.

Browser

Option Description
name Browser used for cookie discovery

Proxy

Option Description
http_proxy Optional outbound proxy

EnabledAI

Option Description
gemini Enable or disable Gemini

Docker Notes

For Playwright deployments:

  1. Run authentication on the host machine.
  2. Generate runtime/auth/gemini.json.
  3. Start the Docker container.
  4. Restart the container whenever authentication is refreshed.

See Docker.md for complete deployment instructions.


Logging Configuration

WebAI-to-API logging behavior can be configured centrally to manage console output verbosity and HTTP access logging.

Priority Resolution

Logging settings are resolved in the following priority order:

  1. CLI Arguments (highest priority)
  2. OS Environment Variables
  3. Configuration File ([Logging] section in config.conf, if present)
  4. System Defaults (INFO level, access logs enabled)

Local Configuration Options

You can manage logging in config.conf using the [Logging] section:

[Logging]
# Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL
level = INFO
# Disable Uvicorn request logs (default: false)
disable_access_logs = false

Local Execution Examples

  • Default Run (runs at INFO level, access logs enabled):
    poetry run python src/run.py
  • Enable DEBUG via CLI:
    poetry run python src/run.py --log-level debug
  • Enable DEBUG via Environment Variable:
    LOG_LEVEL=DEBUG poetry run python src/run.py
  • Disable HTTP Access Logs:
    poetry run python src/run.py --disable-access-logs

Configuration Template

The full configuration template is available in:

config.conf.example