Interface SogniClientConfig

interface SogniClientConfig {
    apiKey?: string;
    appId: string;
    authType?: "token" | "cookies" | "apiKey";
    logger?: Logger;
    logLevel?: LogLevel;
    multiInstance?: boolean;
    network?: SupernetType;
    testnet?: boolean;
}

Properties

apiKey?: string

API key for authentication. When provided, the client will use API key authentication instead of username/password login. API keys support both socket-based operations (image generation, LLM chat) and most REST API calls (balance, profile, etc.). Sensitive account operations (withdrawals, staking, 2FA) are not available with API key auth.

appId: string

The application ID string. Must be unique, multiple connections with the same ID will be rejected.

authType?: "token" | "cookies" | "apiKey"

Authentication type to use. Can be 'token', 'cookie', or 'apiKey'. If not provided, 'token' will be used. When apiKey is provided in the config, this is automatically set to 'apiKey'. token authentication relies on a token stored in the client instance. This is what 3rd party Node.js apps should use. cookie authentication relies on htmlOnly cookie, set by the server. This will only work for browser apps located on .sogni.ai subdomains due to CORS restrictions. apiKey authentication uses a pre-generated API key.

'token'
@experimental
logger?: Logger

Logger to use. If not provided, a default console logger will be used

logLevel?: LogLevel

Log level to use. This option is ignored if a logger is provided

'warn'
multiInstance?: boolean

Browser only. If true, the client will use a single WebSocket connection shared across multiple tabs. This is useful for browser apps that need to process multiple projects at the same time. Only works in browser environment and with cookie authentication.

false
@experimental
network?: SupernetType

Which network to use after logging in. Can be 'fast' or 'relaxed'

'fast'
testnet?: boolean

If true, the client will connect to the testnet. Ignored if jsonRpcUrl is provided