Ping the session by attempting a simple chat completion.
If the chat completion fails, the session is considered dead and will be closed automatically. This is useful for health checks and monitoring session availability.
API key in format: Bearer sk-xxxxxx
Response
Status of the session: alive, dead, or no_session
The session ID that was pinged (if a session exists)
Response time in milliseconds for the ping test
Status message describing the ping result
How It Works: The ping endpoint sends a minimal chat completion request to the provider. If the provider responds successfully within the timeout period, the session is considered alive. If it fails or times out, the session is automatically closed.
Automatic Closure: If a session fails the ping test, it will be automatically closed to prevent billing for an unresponsive session. You’ll need to create a new session to continue.
Health Monitoring: Use this endpoint in your application’s health checks or monitoring systems to proactively detect and handle dead sessions before users encounter errors.
Best Practice: Implement periodic pings (e.g., every 5 minutes) for long-running sessions to ensure they remain active and responsive. This is especially important for sessions that may experience periods of inactivity.