How do you set a users group? I am using the UserModel to create a user, and then injecting that into the User API service as is instructed in the documentation. The only thing I am not seeing is how to set the group. 

I looked in the Model class and there is no method for setting the group and it's not part of the defineAttributes() method. 

In the documentation there is no method to set group, just read only the groups: https://craftcms.com/docs/templating/usermodel#getGroups

Nothing here about it: https://craftcms.com/classreference/services/UsersService

Here is what I am doing to save user.

$user = new UserModel;

$user-&gt;username = 'username';
$user-&gt;email = 'yourmom@email.com';
// $user-&gt;groupID = "group";
$user-&gt;firstName = 'first name';
$user-&gt;lastName = 'last name';
$user-&gt;getContent()-&gt;setAttributes([ 'usersAddress' =&gt; 'Your face' ]);

craft()-&gt;users-&gt;saveUser($user);


Am I missing something obvious?
It's not documented, but UserGroupsService has a method assignUserToGroups($userId, int|array $groupIds). You'll have to save your user first, but once you have a user id, I believe you can just use that with something like this:

// Original code
$user = new UserModel;

$user-&gt;username = 'username';
$user-&gt;email = 'user@email.com';
$user-&gt;firstName = 'first name';
$user-&gt;lastName = 'last name';
$user-&gt;getContent()-&gt;setAttributes([ 'usersAddress' =&gt; 'Your face' ]);

craft()-&gt;users-&gt;saveUser($user);

// Add to single group
craft()-&gt;userGroups-&gt;assignUserToGroups($user-&gt;id, $groupId);

// OR, add to multiple groups
craft()-&gt;userGroups-&gt;assignUserToGroups($user-&gt;id, [$groupIdOne, $groupIdTwo]);