Every developer’s program differs: some handle JSON well, some XML, some plain TXT. So why not just respond in the format you need? ip.renfei.net now returns different formats based on the Accept request header.
Default: JSON
When you don’t declare an Accept header — hitting it with curl, say — or when you declare one that isn’t supported, JSON is returned by default. For example:

Returning XML
When your program needs XML, declare Accept as xml, text/xml, or application/xml, and you’ll get:

Returning Plain Text
When your program needs plain TEXT, declare Accept as text or text/plain, and you’ll get:

Returning HTML
When the Accept header is text/html or application/xhtml+xml, you’ll get:

IPv4 and IPv6
ip.renfei.net is IPv6/IPv4 dual-stack (IPv6 preferred).
If you only want the IPv4 address, use ipv4.renfei.net
If you only want the IPv6 address, use ipv6.renfei.net
It Got Slower
Since this API is mostly called by programs rather than humans, it generates far more traffic and requests than human browsing, and the resource cost kept growing. I had no choice but to bring in a free CDN to spread the load, which slows access down. I don’t think that’s a problem though: it was originally built for DDNS dynamic DNS, and IP addresses don’t change in real time — maybe once every few hours or days. As long as your program keeps polling in a loop, waiting a few extra seconds is fine.
Anything Else
This API already allows cross-origin requests, so you can call it from your own pages to get the visitor’s public IP.
If you need more, open an Issue.
