Skip to main content

Connections

Connections

toothfairyai@latest…

Manager for connections (Hosting) operations.

This manager provides methods to create, update, and manage connections (Hostings). Note: In the API, /connection/* endpoints map to Hosting entities.

Example:

>>> client = ToothFairyClient(api_key="...", workspace_id="...")
>>> connection = client.connections.create(
... name="OpenAI Connection",
... type="openai",
... endpoint="https://api.openai.com",
... )

Accessed via client.connections.

Methods

MethodHTTPEndpoint
createPOSTPOST /connection/create
updatePOSTPOST /connection/update
deleteDELETEDELETE /connection/delete/{connection_id}
getGETGET /connection/get/{connection_id}
listGETGET /connection/list
get_by_typederived
searchderived

create

Create a new connection (Hosting).

def create(
name: str,
type: HostingTypeRequest,
endpoint: Optional[str] = None,
model_name: Optional[str] = None,
base_model: Optional[str] = None,
custom_model: bool = False,
api_version: Optional[str] = None,
token_secret: Optional[str] = None,
description: Optional[str] = None
) -> Hosting

Endpoint: POST /connection/create · API service

Request fields

FieldTypeRequiredDescription
idstringnoUnique identifier for the connection
workspaceidstringyesYour workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually.
namestringyesName of the resource
descriptionstringnoConnection description
typestringyesConnection type (database, API, etc.)

Allowed: sql, oracle, mysql, postgressql | | host | string | yes | Database host address | | port | integer | yes | Database port number (1-65535) | | username | string | yes | Connection username | | passwordSecret | string | yes | Encrypted password reference | | database | string | no | Database name | | schema | string | no | Database schema name | | ssl | boolean | no | Whether to use SSL connection | | ssh | boolean | no | Whether to use SSH tunnel | | sshHost | string | no | SSH host address | | sshPort | integer | no | SSH tunnel port number (1-65535) | | sshUsername | string | no | SSH tunnel username | | sshPasswordSecret | string | no | SSH password reference |

The Python SDK accepts snake_case keyword arguments and converts them to the camelCase wire fields shown above.

Response fields

FieldTypeDescription
idstringUnique identifier for the connection
namestringName of the resource
descriptionstringConnection description
typestringConnection type (database, API, etc.)
hoststringDatabase host address
portstringDatabase port number (1-65535)
usernamestringConnection username
passwordSecretstringEncrypted password reference
databasestringDatabase name
schemastringDatabase schema name
sslbooleanWhether to use SSL connection
sshbooleanWhether to use SSH tunnel
sshHoststringSSH host address
sshPortstringSSH tunnel port number (1-65535)
sshUsernamestringSSH tunnel username
sshPasswordSecretstringSSH password reference
workspaceIDstringUnique workspace identifier (UUID v4)
createdBystringUser ID who created the connection
updatedBystringUser ID who last updated the connection
createdAtstringTimestamp when this resource was created
updatedAtstringTimestamp when this resource was last updated

Example

client.connections.create(name="…", type=)

update

Update a connection (Hosting).

def update(connection_id: str) -> Hosting

Endpoint: POST /connection/update

Field-level schema not available in the API spec for this endpoint.

Example

client.connections.update(connection_id="agent-id")

delete

Delete a connection.

def delete(connection_id: str) -> Dict[str, bool]

Endpoint: DELETE /connection/delete/{connection_id} · API service

Response fields

FieldTypeDescription
successbooleanOperation success status
dataobjectResponse data
messagestringOptional success message

Example

client.connections.delete(connection_id="agent-id")

get

Get a connection by ID.

def get(connection_id: str) -> Hosting

Endpoint: GET /connection/get/{connection_id} · API service

Response

Returns the Connection object — fields documented in the create section above.

Example

client.connections.get(connection_id="agent-id")

list

List all connections.

def list(
limit: Optional[int] = None,
offset: Optional[int] = None
) -> ListResponse

Endpoint: GET /connection/list · API service

Example

client.connections.list()

get_by_type

Get connections by hosting type.

def get_by_type(hosting_type: HostingType) -> List[Hosting]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.connections.get_by_type(hosting_type=)

Search connections by name.

def search(search_term: str) -> List[Hosting]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

client.connections.search(search_term="…")