isChatGptCodexEndpoint function
Whether baseUrl addresses the ChatGPT Codex backend: an allow-listed
ChatGPT host serving the /backend-api/codex path family. This is the
URL half of the codex model-list dialect's dispatch match (the identity
half is the chatgpt/chatgpt-codex provider hint) — shared by the
core dispatch and every picker's hint mapping.
Implementation
bool isChatGptCodexEndpoint(String baseUrl) {
final uri = Uri.tryParse(baseUrl);
if (uri == null) return false;
return isAllowedChatgptHost(uri.host) &&
uri.path.startsWith('/backend-api/codex');
}