Skip to content

http_client

relationalai.agent.cortex
http_client(
conn: SnowflakeConnection, timeout: int = 300, host: str | None = None
) -> httpx.Client

Create an authenticated HTTP client for Snowflake Cortex API requests.

  • conn

    (SnowflakeConnection) - An active Snowflake connection used to extract the session token.
  • timeout

    (int, default: 300) - Request timeout in seconds. Default: 300.
  • host

    (str, default: None) - Override for the base URL host. Accepts a bare hostname (e.g. amd01.east-us-2.azure.snowflakecomputing.com) or a full URL with scheme. When omitted, conn.host is used if it is a regional Snowflake hostname; otherwise the URL is built from CURRENT_ACCOUNT() so it matches Snowflake’s default REST TLS certificate.
  • httpx.Client - A configured HTTP client with authentication headers and the correct Snowflake base URL.
from relationalai.config import Config
conn = create_config().get_session().connection
client = http_client(conn)