feat: complete production-quality Model Router AI traffic control platform

This commit is contained in:
Vardhman Gupta
2026-08-31 17:33:38 +05:30
commit 4e6f742272
66 changed files with 8969 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
const API_BASE = 'http://localhost:8000';
export async function fetchApi<T>(endpoint: string, options?: RequestInit): Promise<T> {
const url = endpoint.startsWith('http') ? endpoint : `${API_BASE}${endpoint}`;
const res = await fetch(url, {
...options,
headers: {
'Content-Type': 'application/json',
...(options?.headers || {}),
},
});
if (!res.ok) {
const errData = await res.json().catch(() => ({ detail: res.statusText }));
throw new Error(errData.detail || `Request failed with status ${res.status}`);
}
return res.json();
}