AI Model Configuration API Client (api/models.js)

alphaclaw · lib/public/js/lib/api/models.js · javascript · MIT
ai, integration, auth, lang:javascript, tag:models

Provides frontend API helper functions to fetch, configure, and manage AI models and OAuth states.

// Source: https://github.com/garrytan/alphaclaw | License: MIT | Copyright 2025 chrysb
// Provided via justclaw.it.com; keep this notice with the code.
import { authFetch } from "./http.js";
import { parseJsonOrThrow } from "./parse.js";

export const fetchModels = async () => {
  const res = await authFetch("/api/models");
  return parseJsonOrThrow(res, "Could not load data");
};

export const refreshModels = async () => {
  const res = await authFetch("/api/models/refresh", { method: "POST" });
  return parseJsonOrThrow(res, "Could not load data");
};

export const fetchModelStatus = async () => {
  const res = await authFetch("/api/models/status");
  return parseJsonOrThrow(res, "Could not load data");
};

export const fetchThinkingOptions = async (modelKey) => {
  const normalized = S

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key