0feb16a0c0
1.1.1 omits the model from normalizeModel's allowlist, so requests for gpt-6.1-terra are rewritten to gpt-5.5. ChatGPT accounts are not entitled to gpt-5.5, so the request fails with model_not_found. Add the model to the allowlist, allowed reasoning efforts, and default effort. Covered by the transform tests.
78 lines
2.1 KiB
Nix
78 lines
2.1 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "codex-oauth-proxy";
|
|
version = "1.1.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "dvcrn";
|
|
repo = "codex-oauth-proxy";
|
|
# Upstream tags are bare semver, without the "v" prefix.
|
|
rev = version;
|
|
hash = "sha256-WZN+OVvK5/R46Ko01jw4m9jI9BcvpZzxWifcui90/g4=";
|
|
};
|
|
|
|
vendorHash = "sha256-hb0rGd+HZHSV/sLXiIa7LPkXVuRqdXrQHZxM4v5sgvs=";
|
|
|
|
# 1.1.1 rewrites gpt-6.1-terra to gpt-5.5, which ChatGPT accounts reject.
|
|
# Drop once upstream lists the model in normalizeModel.
|
|
patches = [ ./gpt-6.1-terra.patch ];
|
|
|
|
env.CGO_ENABLED = 0;
|
|
|
|
# cmd/codex-oauth-proxy-worker and parts of internal/server are js && wasm
|
|
# Cloudflare Worker code needing syscall/js, so only the server is buildable.
|
|
subPackages = [ "cmd/codex-oauth-proxy" ];
|
|
|
|
# The Nix source tree has no .git, so Go's VCS stamping fails without it.
|
|
# Set before the build and check phases, which both call `go`.
|
|
preConfigure = ''
|
|
export GOFLAGS="$GOFLAGS -buildvcs=false"
|
|
'';
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
];
|
|
|
|
# Upstream CI runs `go test -v ./...` and the suite only uses httptest and
|
|
# t.Setenv, so it needs neither network nor credentials. The default check
|
|
# phase would reuse subPackages and test only the server, hence the override.
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
|
|
# Tests may read assets relative to their package directory.
|
|
export GOFLAGS=''${GOFLAGS//-trimpath/}
|
|
|
|
go test -v ./...
|
|
|
|
runHook postCheck
|
|
'';
|
|
|
|
passthru = {
|
|
category = "AI LLM Gateway";
|
|
updateScript = [
|
|
"nix-update"
|
|
"--flake"
|
|
".#codex-oauth-proxy"
|
|
];
|
|
};
|
|
|
|
meta = {
|
|
description = "Local proxy exposing a ChatGPT Codex account through OpenAI-compatible APIs";
|
|
homepage = "https://github.com/dvcrn/codex-oauth-proxy";
|
|
changelog = "https://github.com/dvcrn/codex-oauth-proxy/releases/tag/${version}";
|
|
license = lib.licenses.mit;
|
|
sourceProvenance = with lib.sourceTypes; [ fromSource ];
|
|
mainProgram = "codex-oauth-proxy";
|
|
platforms = lib.platforms.unix;
|
|
maintainers = [ ];
|
|
};
|
|
}
|