Playlist IDs from MusicKit not working with Apple Music API

I am building an app for MacOS and I am trying to implement the code to add songs to a library playlist (which is added below). The issue I am having is that if I use Music Kit to load a users library playlists, the ID for the playlist (which is just a string of numbers) does not work with the Add tracks to a Library Playlist endpoint of Apple Music API. If I retrieve the playlists from the Apple Music API and use that playlist ID (which is different than the id I get from MusicKit) my code works fine and adds the song to the playlist. The problem is that when getting a users library playlists from Apple Music API is that it does not give me all of the library playlists that I get when using Music Kit and it also does not give me Artwork for playlists that have the collage of album covers, so I would prefer to use Music Kit to get the playlists.
I have also tested trying to retrieve a single playlist using the Apple Music API with the playlist Id from Music Kit and it does not work. I get the error that the resource cannot be found. Since this is a macOs app I cannot use MusicKit to add songs to library playlists.
Does anyone know a way to resolve this? Or a possible workaround? Ideally I want to use MusicKit to get the library playlists and have some way to use the playlist Id and add songs to that playlist. Below is my code for adding a song to a playlist using the Apple Music API, which works correctly only if I originally get the library playlist's id value from a playlist retrieved from the Apple Music API. Also, does anyone know why the playlist Id's are not universal and are different when using Music Kit and Apple Music API? For songs and tracks it does not seem to matter if I use music kit or Apple Music API, the Id's are in the correct format for Apple Music API to use and work with my code. Thanks everyone for any and all help!

func addToPlaylist(songs: [Track], playlist: Playlist, alert: Binding<AlertItem?>) async {
    let tracks = AppleMusicPlaylistPostRequestBody(data: songs.compactMap {
        AppleMusicPlaylistPostRequestItem(id: $0.id.rawValue, type: "songs") // or "library-songs"
    })
    
    let playlistID = playlist.id
    
    // Build the request URL for adding a song to a playlist
    guard let url = URL(string: "https://api.music.apple.com/v1/me/library/playlists/\(playlistID)/tracks") else {
        alert.wrappedValue = AlertItem(title: "Error", message: "Invalid URL for the playlist.")
        return
    }
    
    // Authorization Header
    guard let musicUserToken = try? await MusicUserTokenProvider().getUserMusicToken() else {
        alert.wrappedValue = AlertItem(title: "Error", message: "Unable to retrieve Music User Token.")
        return
    }
    
    do {
        var request = URLRequest(url: url)
        request.httpMethod = "POST"
        request.setValue("Bearer \(musicUserToken)", forHTTPHeaderField: "Authorization")
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        
        let encoder = JSONEncoder()
        let data = try encoder.encode(tracks)
        request.httpBody = data
        
        let musicRequest = MusicDataRequest(urlRequest: request)
        let musicRequestResponse = try await musicRequest.response()
        
        // Check if the request was successful (status 201)
        if musicRequestResponse.urlResponse.statusCode == 201 {
            alert.wrappedValue = AlertItem(title: "Success", message: "Song successfully added to the playlist.")
        } else {
            print("Status Code: \(musicRequestResponse.urlResponse.statusCode)")
            print("Response Data: \(String(data: musicRequestResponse.data, encoding: .utf8) ?? "No Data")")
            
            // Attempt to decode the error response into the AppleMusicErrorResponse model
            if let appleMusicError = try? JSONDecoder().decode(AppleMusicErrorResponse.self, from: musicRequestResponse.data) {
                let errorMessage = appleMusicError.errors.first?.detail ?? "Unknown error occurred."
                alert.wrappedValue = AlertItem(title: "Error", message: errorMessage)
            } else {
                alert.wrappedValue = AlertItem(title: "Error", message: "Failed to add song to the playlist.")
            }
        }
    } catch {
        alert.wrappedValue = AlertItem(title: "Error", message: "Network error: \(error.localizedDescription)")
    }
}
Playlist IDs from MusicKit not working with Apple Music API
 
 
Q