{ lib, python3Packages, fetchPypi, }: python3Packages.buildPythonApplication rec { pname = "codex-api-proxy"; version = "0.1.6"; pyproject = true; # The sdist filename uses an underscore; PyPI's legacy source path only # resolves that spelling. src = fetchPypi { pname = "codex_api_proxy"; inherit version; hash = "sha256-EjH5Lz1hYH0K/i6kzcXVZMJSWSppuibOP5hVreod6po="; }; # pyproject.toml has no [build-system] table, so the default setuptools # backend builds the src/ layout. build-system = with python3Packages; [ setuptools ]; # [project.dependencies] plus the uvicorn[standard] extra. dependencies = with python3Packages; [ fastapi httpx uvicorn ] ++ uvicorn.optional-dependencies.standard; nativeCheckInputs = with python3Packages; [ pytestCheckHook pytest-asyncio ]; # test_release_version.py imports scripts/set_version.py and expects the # Makefile, neither of which is part of the sdist. disabledTestPaths = [ "tests/test_release_version.py" ]; # These two monkeypatch main's auth loader, but models.list_models calls the # auth module's loader directly, so they need a real ~/.codex/auth.json. disabledTests = [ "test_models_endpoint_uses_cache" "test_models_endpoint_refresh_bypasses_cache" ]; pythonImportsCheck = [ "codex_api_proxy" ]; passthru = { category = "AI LLM Gateway"; updateScript = [ "nix-update" "--flake" ".#codex-api-proxy" ]; }; meta = { description = "Local OpenAI-compatible HTTP proxy backed by Codex/OpenAI credentials"; homepage = "https://pypi.org/project/codex-api-proxy/"; changelog = "https://pypi.org/project/codex-api-proxy/#history"; license = lib.licenses.mit; sourceProvenance = with lib.sourceTypes; [ fromSource ]; mainProgram = "codex-api-proxy"; platforms = lib.platforms.unix; maintainers = [ ]; }; }