{ lib, python3Packages, fetchFromGitHub, fetchurl, makeWrapper, }: let cerebras-cloud-sdk = python3Packages.buildPythonPackage rec { pname = "cerebras-cloud-sdk"; version = "1.67.0"; pyproject = true; src = fetchurl { url = "https://files.pythonhosted.org/packages/92/12/c201f07582068141e88f9a523ab02fdc97de58f2f7c0df775c6c52b9d8dd/cerebras_cloud_sdk-1.67.0.tar.gz"; hash = "sha256-Ou1vhsbHqD7p1M+wiirOoInOvyr1uK7RFu95mVpPSBM="; }; build-system = with python3Packages; [ hatchling hatch-fancy-pypi-readme ]; postPatch = '' sed -i 's/hatchling==[0-9.]*/hatchling/' pyproject.toml ''; dependencies = with python3Packages; [ anyio distro httpx pydantic sniffio typing-extensions ]; doCheck = false; meta = { description = "Python SDK for Cerebras AI platform"; homepage = "https://github.com/CerebrasAI/cerebras-cloud-sdk-python"; license = lib.licenses.asl20; }; }; pyDeps = with python3Packages; [ fastapi uvicorn google-genai cerebras-cloud-sdk groq mistralai requests python-dotenv pydantic httpx ]; in python3Packages.buildPythonApplication { pname = "relay-free-llm"; version = "0.1.0+unstable"; format = "other"; src = fetchFromGitHub { owner = "msmarkgu"; repo = "RelayFreeLLM"; rev = "fea9e1642dbbc5c0980885f41b21aa04a30090a2"; hash = "sha256-ZLAVhJFrVFjqAz0f4qOi2REBDccIc8g2H9b7dcqcYRU="; }; nativeBuildInputs = [ makeWrapper ]; propagatedBuildInputs = pyDeps; installPhase = '' runHook preInstall mkdir -p $out/lib/relay-free-llm cp -r src $out/lib/relay-free-llm/ runHook postInstall ''; postInstall = '' makeWrapper ${python3Packages.python.interpreter} $out/bin/relay-free-llm \ --add-flags "-m src.server" \ --prefix PYTHONPATH : "$out/lib/relay-free-llm:$PYTHONPATH" ''; doCheck = false; passthru = { category = "AI LLM Gateway"; updateScript = [ "nix-update" "--flake" ".#relay-free-llm" "--version=branch=main" ]; }; meta = { description = "RESTful API to route user prompts to various AI model providers"; homepage = "https://github.com/msmarkgu/RelayFreeLLM"; license = lib.licenses.mit; mainProgram = "relay-free-llm"; platforms = lib.platforms.all; }; }