Files
Kaname/src/app/api/endpoints/[id]/route.ts
T
Pascal LinxweilerandClaude Opus 5.5 276108932d
Release / release (push) Successful in 12m32s
Release 0.15.0: endpoints instead of deployments
Kaname keeps two jobs: the model downloader and benchmarks. Benchmarks
now run against endpoints (any OpenAI-compatible server added by URL,
with an optional server-side API key and hand-written hardware notes)
instead of deployments Kaname started itself.

Removed: runtimes, deployments, sweeps, resource telemetry, hardware
detection, the /api/v1 API with tokens and guardrails, and all Docker
access. The quality eval's coding tests run in a network-less sandbox
container that shares only an exchange folder with the worker.

The previous state is kept in branch backup / tag backup-0.14.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:43:42 +01:00

33 lines
1.3 KiB
TypeScript

import { NextResponse } from "next/server";
import { withAuth } from "@/lib/api-auth";
import { apiError, handleApiError } from "@/lib/api-errors";
import { deleteEndpoint, EndpointError, getEndpoint, updateEndpoint } from "@/lib/endpoints";
export const dynamic = "force-dynamic";
const fail = (err: unknown) => (err instanceof EndpointError ? apiError(err.status, err.code, err.message) : handleApiError(err));
export const GET = withAuth<RouteContext<"/api/endpoints/[id]">>(async (_req, { params }) => {
const e = await getEndpoint((await params).id);
return e ? NextResponse.json(e) : apiError(404, "not_found", "Endpoint not found.");
});
/** Change an endpoint; leave `apiKey` out to keep the stored key, send "" to remove it. */
export const PATCH = withAuth<RouteContext<"/api/endpoints/[id]">>(async (req, { params }) => {
try {
return NextResponse.json(await updateEndpoint((await params).id, await req.json()));
} catch (err) {
return fail(err);
}
});
/** Delete an endpoint; its runs stay (with their snapshot). */
export const DELETE = withAuth<RouteContext<"/api/endpoints/[id]">>(async (_req, { params }) => {
try {
await deleteEndpoint((await params).id);
return new NextResponse(null, { status: 204 });
} catch (err) {
return fail(err);
}
});