import { env } from "../lib/env"; import type { UserProfile } from "./types"; async function kimiRequest( path: string, token: string, init?: RequestInit, ): Promise { const resp = await fetch(`${env.kimiOpenUrl}${path}`, { ...init, headers: { Accept: "application/json", Authorization: `Bearer ${token}`, ...init?.headers, }, }); if (!resp.ok) { const text = await resp.text(); console.warn( `[kimi] Request to ${path} failed (${resp.status}): ${text}`, ); return null; } return resp.json() as Promise; } export const users = { getProfile: (token: string) => kimiRequest("/v1/users/me/profile", token), };