Optional
apiOptional
baseOverride the default base URL for the API, e.g., "https://api.example.com/v2/"
Defaults to process.env['GBOX_CLIENT_BASE_URL'].
Optional
defaultDefault headers to include with every request to the API.
These can be removed in individual requests by explicitly setting the
header to null
in request options.
Optional
defaultDefault query parameters to include with every request to the API.
These can be removed in individual requests by explicitly setting the
param to undefined
in request options.
Optional
environmentSpecifies the environment to use for the API.
Each environment maps to a different base URL:
production
corresponds to https://gbox.ai/api/v1/
selfHosting
corresponds to http://localhost:28080/api/v1/
internal
corresponds to http://gru.localhost:2080/api/v1/
Optional
fetchSpecify a custom fetch
function implementation.
If not provided, we expect that fetch
is defined globally.
Optional
fetchAdditional RequestInit
options to be passed to fetch
calls.
Properties will be overridden by per-request fetchOptions
.
Optional
loggerSet the logger.
Defaults to globalThis.console.
Optional
logSet the log level.
Defaults to process.env['GBOX_CLIENT_LOG'] or 'warn' if it isn't set.
Optional
maxThe maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server.
Optional
timeoutThe maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request.
Note that request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails.
Defaults to process.env['GBOX_API_KEY'].