The line of dialogue that is punctuated correctly is:
"I want a pet," James said.
(Note: this was the first response you provided, and it correctly punctuates the dialogue with the comma before the closing quotation mark.)
The other options have punctuation issues.