self.current_request.headers.get().
Request headers are per-request context, complementing environment variables which are per-runner context. Use headers when you need to identify the specific request or caller (for logging, tracing, or per-user logic), and environment variables for runner-wide information like FAL_APP_NAME or FAL_KEY.
Available Headers
| Header | Description |
|---|---|
x-fal-request-id | Unique identifier for this request. Use for log correlation and debugging. |
x-fal-caller-user-id | The caller’s user ID (hashed for third-party apps). Useful for per-user logic. |
x-fal-endpoint | The full endpoint path being called (e.g., your-user/your-app/). |
x-fal- are reserved for the gateway and cannot be set by callers.
Correlating with External Tools
Sentry
Attach the request ID to Sentry events so you can find the exact fal request that caused an error:Structured Logging
Include the request ID in your log output for correlation with fal’s built-in logs:Custom Headers
Callers can pass custom headers that are forwarded to your app:Header names are case-insensitive.
X-My-Header and x-my-header both work.Response Header Size Limit
The total size of all response headers returned by your app is limited to 16 KB. This includes platform headers injected by fal (likex-fal-request-id and X-Fal-Billable-Units) and any custom headers your app sets, such as billing units or routing hints from provide_hints(). If the combined headers exceed 16 KB, the response will fail.
Keep custom header values short. If you use provide_hints(), avoid returning large lists of model names or long strings — each hint value contributes to the total header size.
Platform headers like
X-Fal-Request-Timeout, X-Fal-No-Retry, and X-Fal-Store-IO are processed by the gateway before reaching your runner. They are not available in self.current_request.headers. Only identity headers (x-fal-request-id, x-fal-caller-user-id, x-fal-endpoint) and custom caller headers are forwarded to your app.Environment Variables
Per-runner context: FAL_KEY, FAL_APP_NAME, FAL_RUNNER_STATE, and more