// Routes: GET /ai/xai/platform/status and /ai/xai/platform/calls #include "support/Assert.hpp" using namespace molo::example::test; int main() { unsetenv("XAI_API_KEY"); unsetenv("XAI_MANAGEMENT_KEY"); Fixture f; auto res = f.client->get("/ai/xai/platform/status"); check(res.status == 200, "status 200"); check(contains(res.body, "\"api_key_configured\":false"), "reports no api key"); check(contains(res.body, "\"management_key_configured\":false"), "reports no management key"); check(contains(res.body, "https://management-api.x.ai"), "management host is separate"); check(!contains(res.body, "Bearer"), "no credential in the body"); auto calls = f.client->get("/ai/xai/platform/calls"); check(calls.status == 200, "calls 200"); check(contains(calls.body, "/v1/realtime/client_secrets"), "table lists client secrets"); check(contains(calls.body, "/auth/teams/{teamId}/api-keys"), "table lists key management"); check(contains(calls.body, "\"host\":\"management\""), "table names the host"); setenv("XAI_API_KEY", "k-test", 1); Fixture g; check(contains(g.client->get("/ai/xai/platform/status").body, "\"api_key_configured\":true"), "reports api key"); check(!contains(g.client->get("/ai/xai/platform/status").body, "k-test"), "never echoes the key"); unsetenv("XAI_API_KEY"); check(f.client->post("/ai/xai/platform/status", "{}", "application/json").status == 405, "post is 405"); check(f.client->post("/ai/xai/platform/calls", "{}", "application/json").status == 405, "calls post is 405"); return finish("ai/xai/platform/status"); }