Either it has seen the API docs, or because people who write APIs are boring and predictable in their nomenclature. My money is on the latter. This is why CS people tend to be the most impressed by ChatGPT.