I don't really know much about licensing.
As far as I know there's nothing stopping you from creating applications with the JS API using either the esri-hosted source code or downloading the source code from the developer site and hosting it yourself. A caveat here is that the source code is only publicly distributed in a minified form.
My feeling is that the JS API is suitable for client apps, although the majority of developer users seem to be Esri platform users. If you use the API this way, you'll be using Esri's public (and free) basemaps. Apparently these basemaps do have a request limit, but for most users 50 million transactions per year is probably fine.
Everything else can be done in the client, like adding graphics (features) and layers, handling user-input, click events, and so on. The API also includes a geometry engine that contains some helpful functionality, all performed in the client.
One pitfall I could see is that a lot of the widgets in the API rely on an Esri back-end. For example, the geocoder will make requests to the ArcGIS Online geocoder. Parts of this service are free, but parts are not (more information).
If you can explain a little bit about what kind of functionality you're looking for I can go into more detail.