private static HttpHeaders extractHeadersFromAiResponse(final String aiResponse) {
        HttpHeaders headers = new HttpHeaders();
        if (Objects.isNull(aiResponse) || aiResponse.isEmpty()) {
            return headers;
        }
        try (BufferedReader reader = new BufferedReader(new StringReader(aiResponse))) {
            String line;
            boolean headerSectionStarted = false;
            while (Objects.nonNull(line = reader.readLine())) {
                if (!headerSectionStarted) {
                    if (line.startsWith("HTTP/1.1") || line.matches("^(GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD)\\s.*\\sHTTP/1.1$")) {
                        headerSectionStarted = true;
                        continue;
                    }
                } else {
                    if (line.trim().isEmpty()) {
                        break;
                    }
                    int colonIndex = line.indexOf(":");
                    if (colonIndex > 0) {
                        String name = line.substring(0, colonIndex).trim();
                        String value = line.substring(colonIndex + 1).trim();
                        headers.add(name, value);
                    }
                }
            }
        } catch (IOException e) {
            LOG.error("AI request transformer plugin: extract headers from AiResponse fail");
        }
        return headers;
    }
this is ai request transformer plugin.
shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-request-transformer/src/main/java/org/apache/shenyu/plugin/ai/transformer/request/AiRequestTransformerPlugin.java