Skip to main content

Configuration

This page explains how to configure the SDK using environment variables and optional client parameters.

Environment variables

Set these variables before running your code:

export T2E_ACCESS_TOKEN="your-access-token"
export T2E_WORKSPACE_NAME="workspaces/your-workspace"
export TEXT2EVERYTHING_BASE_URL="https://your-api-endpoint.com" # Optional; omit to use default

Summary:

VariableRequiredPurposeDefault
T2E_ACCESS_TOKENYesAuthenticates API requestsNone (must set)
T2E_WORKSPACE_NAMEYesSelects workspace scopeNone (must set)
TEXT2EVERYTHING_BASE_URLNoOverrides base API endpointBuilt-in default

If TEXT2EVERYTHING_BASE_URL is not set, the client uses the default endpoint.

Basic usage

import os
from text2everything_sdk import Text2EverythingClient

client = Text2EverythingClient(
base_url=os.getenv("TEXT2EVERYTHING_BASE_URL"), # May be None; default applied internally
access_token=os.getenv("T2E_ACCESS_TOKEN"),
workspace_name=os.getenv("T2E_WORKSPACE_NAME"),
)

You can provide values directly (discouraged for secrets):

client = Text2EverythingClient(
base_url="https://your-api-endpoint.com",
access_token="your-token",
workspace_name="workspaces/dev",
)

Advanced options

Optional tuning parameters:

ParameterTypePurpose
timeoutintPer-request timeout (seconds)
max_retriesintRetry attempts for transient failures
retry_delayfloatDelay between retries (seconds)

Example:

client = Text2EverythingClient(
base_url="https://your-api-endpoint.com",
access_token="your-token",
workspace_name="workspaces/dev",
timeout=60,
max_retries=5,
retry_delay=2.0,
)

Context manager usage

Use a context manager to ensure resources (like HTTP sessions) are released:

from text2everything_sdk import Text2EverythingClient

with Text2EverythingClient(base_url="https://your-api-endpoint.com", access_token="your-token", workspace_name="workspaces/dev") as client:
for project in client.projects.list():
print(project.name)

Next steps

Proceed to the quick start or advanced integration guides after configuration.


Feedback