Why international domain purchases were failing
Vercel customers trying to buy domains with non-English characters were hitting consistent purchase failures. The problem traced back to how internationalized domain names (IDNs) are handled during registration.
Domains with non-English characters must be converted to Punycode — an ASCII-compatible encoding — before they can be sent to a registrar. But when Vercel submitted these encoded domains to its registrar, OpenSRS, the API returned cryptic error messages that didn't reveal the real cause.
Digging into the OpenSRS documentation uncovered the issue: purchasing a Punycode domain requires an associated language code. Vercel's system had a field for this value, but it was marked optional and never populated, so requests went out without it.
The language-detection hurdle
Once the missing field was identified, the next step was figuring out how to determine the correct language code for each domain. Vercel first tried Common Language Detector 2 (CLD2), a library designed to detect the language of a text sample. But domain names are too short for CLD2 to make an accurate guess, so that approach didn't work.
The team then turned to the Vercel AI SDK, an open-source toolkit that provides a unified interface for working with AI models from multiple providers. The abstraction makes it easy to swap models with minimal code changes, which was useful here because the team needed to compare accuracy across models.
They picked the generateText method for this task. The use case needed a single text output — a three-character language code — with no interactive back-and-forth, so streamText wasn't necessary. generateObject, which returns structured data via schemas, was also overkill for such a simple output.
Testing different models to find one with strong accuracy and a context window large enough to include the full list of candidate language codes led the team to GPT-4o from OpenAI. The model was able to correctly map each domain to its language code, even for very short and unusual domain names.
Validation and production deployment
Vercel rigorously tested the GPT-4o–powered solution against all failed domain purchases from the previous two months. The success rate was 100%. That result cleared the way for a production deployment.
Since going live, the system has processed numerous successful Punycode domain purchases, removing a significant barrier for international users. The fix demonstrates how AI can be applied to edge-case engineering problems that traditional heuristics can't reliably solve.



