Gemini.Client.HTTP (GeminiEx v0.8.2)

View Source

Unified HTTP client for both Gemini and Vertex AI APIs using Req.

Supports multiple authentication strategies and provides both regular and streaming request capabilities.

Rate Limiting

All requests are automatically routed through the rate limiter unless disable_rate_limiter: true is passed in options. The rate limiter:

  • Enforces concurrency limits per model
  • Honors 429 RetryInfo delays from the API
  • Retries transient failures with backoff
  • Tracks token usage for budget estimation

See Gemini.RateLimiter for configuration options.

Summary

Functions

Make a DELETE request using the configured authentication.

Make a GET request using the configured authentication.

Make a PATCH request using the configured authentication.

Make a POST request using the configured authentication.

Make an authenticated HTTP request.

Stream a POST request for Server-Sent Events using configured authentication.

Raw streaming POST with full URL (used by streaming manager).

Stream a POST request with specific authentication configuration.

Functions

delete(path, opts \\ [])

Make a DELETE request using the configured authentication.

get(path, opts \\ [])

Make a GET request using the configured authentication.

patch(path, body, opts \\ [])

Make a PATCH request using the configured authentication.

post(path, body, opts \\ [])

Make a POST request using the configured authentication.

request(method, path, body, auth_config, opts \\ [])

Make an authenticated HTTP request.

Options

In addition to standard request options, supports rate limiter options:

  • :disable_rate_limiter - Bypass rate limiting (default: false)
  • :non_blocking - Return immediately if rate limited (default: false)
  • :max_concurrency_per_model - Override concurrency limit

stream_post(path, body, opts \\ [])

Stream a POST request for Server-Sent Events using configured authentication.

stream_post_raw(url, body, headers, opts \\ [])

Raw streaming POST with full URL (used by streaming manager).

stream_post_with_auth(path, body, auth_config, opts \\ [])

Stream a POST request with specific authentication configuration.