aip_sdk.register_judge_connection
aip_sdk.register_judge_connection(name: str, model: str, *, base_url: str | None = None, api_key: str | None = None, project_id: str | None = None, workspace_id: str | None = None, client: APIClient | None = None) -> JudgeConnection
Register a judge connection so metrics can reference it by name.
Stores a named judge — model, optional OpenAI-compatible base URL, and API
key — server-side. The key is encrypted at rest and never returned. Only
name and model are required; omit api_key for an endpoint that
authenticates by network rather than a token.
Parameters
namestr: Connection name, unique within the workspace.modelstr: Judge model id, e.g."gpt-4o-mini".base_urlstr | None: OpenAI-compatible base URL; omit to use the platform default judge. A trailing slash and a trailing/chat/completionsare stripped before storage.api_keystr | None: Plaintext API key, encrypted at rest by the platform.project_idstr | None: Project to scope the connection to.workspace_idstr | None: Workspace to scope the connection to. Pass this orproject_id, not both — a project-scoped connection inherits its workspace from the project. Falls back to the client's configured workspace.clientAPIClient | None: Optional pre-configured API client.
Returns
JudgeConnectionJudgeConnection: the registered connection, with its generatedid.
Raises
InvalidArgumentError: If bothproject_idandworkspace_idare given — a project already determines its workspace.NoWorkspaceSelectedError: If no workspace is passed and none is configured for the session.AuthError: If no credentials are configured.DuplicateJudgeConnectionError: If a connection with this name already exists.APIError: If registration otherwise fails.
Example:
import aip_sdk as aip
aip.init("https://aip.example.com", api_key="...")
judge = aip.register_judge_connection(
name="approved-gpt4o",
model="gpt-4o-mini",
base_url="https://llm.internal.example.com/v1",
api_key="sk-...",
project_id="proj-abc123",
)
print(judge.id, judge.name)