Add user_agent header (#8149)
add `user_agent` header and remove rust tool chain
This commit is contained in:
parent
3a0d9bca64
commit
14d80c35a9
1 changed files with 4 additions and 3 deletions
7
.github/workflows/rust-release-prepare.yml
vendored
7
.github/workflows/rust-release-prepare.yml
vendored
|
|
@ -21,8 +21,6 @@ jobs:
|
|||
ref: main
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: dtolnay/rust-toolchain@1.90
|
||||
|
||||
- name: Update models.json
|
||||
env:
|
||||
OPENAI_API_KEY: ${{ secrets.CODEX_OPENAI_API_KEY }}
|
||||
|
|
@ -30,14 +28,17 @@ jobs:
|
|||
set -euo pipefail
|
||||
|
||||
client_version="99.99.99"
|
||||
terminal_info="github-actions"
|
||||
user_agent="codex_cli_rs/99.99.99 (Linux $(uname -r); $(uname -m)) ${terminal_info}"
|
||||
base_url="${OPENAI_BASE_URL:-https://chatgpt.com/backend-api/codex}"
|
||||
|
||||
headers=(
|
||||
-H "Authorization: Bearer ${OPENAI_API_KEY}"
|
||||
-H "User-Agent: ${user_agent}"
|
||||
)
|
||||
|
||||
url="${base_url%/}/models?client_version=${client_version}"
|
||||
curl --fail --show-error --location "${headers[@]}" "${url}" | jq '.' > codex-rs/core/models.json
|
||||
curl --http1.1 --fail --show-error --location "${headers[@]}" "${url}" | jq '.' > codex-rs/core/models.json
|
||||
|
||||
- name: Open pull request (if changed)
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue