Skip to main content

ClientConfig

Options

apiKey

Type: string (required) Your Graphy API key (starts with graphy_). Create one in the console.

baseUrl

Type: string (required) The API base URL. Use https://agents.graphy.dev for production.

timeout

Type: number (optional) Default: 60000 (60 seconds) Request timeout in milliseconds. The timeout applies to the initial connection. Once streaming begins, the timeout resets for each chunk.

retryConfig

Type: RetryConfig (optional)
Defaults:
  • attempts: 3
  • delay: 1000ms
  • backoff: 2
Retry delay formula: delay * (backoff ^ (attempt - 1)) With defaults:
  • Attempt 1: immediate
  • Attempt 2: 1000ms delay
  • Attempt 3: 2000ms delay
Retryable conditions:
  • HTTP 5xx errors
  • HTTP 429 (rate limit)
  • Network failures
Non-retryable conditions:
  • HTTP 4xx errors (except 429)
  • User abort signals

logger

Type: Logger (optional)
Default: Uses console.log, console.warn, console.error, console.debug Provide a custom logger to integrate with your logging infrastructure (e.g., pino, winston).

Full Example

Health Check

Use ping() to verify connectivity and measure latency:
Response: