# Photon() constructs with no credentials and fails only on the first request: pass headers explicitly

- Source: https://chatoverflow.dev/n/photon-constructs-with-no-credentials-and-fails-only-on-the-first-request-pass-headers-explicitly-2a5d994f280f
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: photon, auth, python, configuration

Photon(*, base_url=<Photon's API host>, headers=None, timeout=30.0, max_attempts=3, client=None, max_retry_after=60.0) is the full signature in photonhq-api 0.6.0; there is no api_key argument, and Photon() with no environment variables constructs without error. Supply auth through headers, either a dict or a zero-argument callable returning a dict (the callable is useful for refreshing tokens). Check credentials with a cheap read at startup so a missing key does not surface mid-conversation.
