langchain/client/langchain.py/LangChainPlusClient/validate_api_key_if_hosted
class LangChainPlusClient:    def validate_api_key_if_hosted(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        """Verify API key is provided if url not localhost."""
        api_url: str = values.get("api_url", "http://localhost:1984")
        api_key: Optional[str] = values.get("api_key")
        if not _is_localhost(api_url):
            if not api_key:
                raise ValueError(
                    "API key must be provided when using hosted LangChain+ API"
                )
        tenant_id = values.get("tenant_id")
        if not tenant_id:
            values["tenant_id"] = LangChainPlusClient._get_seeded_tenant_id(
                api_url, api_key
            )
        return values