Serializers

Serializers for the Proxy app.

class smarter.apps.proxy.serializers.ProxySerializer(*args, **kwargs)[source]

Bases: MetaDataWithOwnershipModelSerializer

Serializer for the smarter.apps.proxy.models.Proxy model.

Used by the web console’s list view and the smarter get proxies CLI command. The API key is rendered as its Secret’s name, never its value.

get_api_key_secret_name(obj)[source]

The name of the Secret whose API key is added to requests: the Proxy’s, else the Provider’s.

Return type:

str | None

get_fields()[source]

Return the dict of field names -> field instances that should be used for self.fields when instantiating the serializer.

get_manifest_url(obj)[source]

The URL of the Proxy’s detail view, which renders its manifest.

Return type:

str

get_provider_name(obj)[source]

The name of the Provider whose API the Proxy forwards to.

Return type:

str

get_upstream_url(obj)[source]

The base URL of the provider’s API, to which requests are forwarded.

Return type:

str

get_url(obj)[source]

The path of the Proxy’s passthrough endpoint, e.g. /api/v1/proxy/openai/.

Return type:

str