mirror of
https://github.com/hanzoai/codex.git
synced 2026-11-23 03:44:32 +00:00
A provider's rate-limit headers pace the requests that follow:
hanzo::pace keeps, per origin, x-ratelimit-{limit,remaining,reset}-
{requests,tokens} and a 429 or 503's Retry-After, and codex-api's
request wrapper waits pace::delay before each request and observes every
response. A spent window holds the next request until it resets; a low
one, a quarter of the limit, is spread over what is left of it.
What still comes back as a 429 that is not a spent plan or quota, a
slow_down, or an overloaded or unavailable server is waited out in the
one retry path, handle_response_stream_error: Retry-After, else full-
jitter backoff from 1s doubling to 60s, with no attempt cap while the
turn lives. Upstream ended a turn on an overloaded model; the owner's
rule is to wait. The wait is the turn's status, sent without error
details so no status code is shown, and `dev exec --json` names every
retried notice `turn.waiting` ({"message": "waiting for rate limit,
retrying in 12s"}); `error` is left for what ends a turn.
Claude-Session: https://claude.ai/code/session_015XYKLnBbrbajqj1GpRydF8
50 lines
1.5 KiB
TOML
50 lines
1.5 KiB
TOML
[package]
|
|
name = "codex-api"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
|
|
[dependencies]
|
|
async-channel = { workspace = true }
|
|
base64 = { workspace = true }
|
|
bytes = { workspace = true }
|
|
chrono = { workspace = true }
|
|
codex-client = { workspace = true }
|
|
codex-http-client = { workspace = true }
|
|
codex-protocol = { workspace = true }
|
|
codex-utils-rustls-provider = { workspace = true }
|
|
codex-websocket-client = { workspace = true }
|
|
futures = { workspace = true }
|
|
http = { workspace = true }
|
|
rustls = { workspace = true }
|
|
schemars = { workspace = true }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json = { workspace = true, features = ["raw_value"] }
|
|
thiserror = { workspace = true }
|
|
tokio = { workspace = true, features = ["fs", "macros", "net", "rt", "sync", "time"] }
|
|
tokio-tungstenite = { workspace = true }
|
|
tungstenite = { workspace = true }
|
|
tracing = { workspace = true }
|
|
eventsource-stream = { workspace = true }
|
|
regex-lite = { workspace = true }
|
|
tokio-util = { workspace = true, features = ["codec", "io"] }
|
|
url = { workspace = true }
|
|
uuid = { workspace = true }
|
|
hanzo = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
anyhow = { workspace = true }
|
|
assert_matches = { workspace = true }
|
|
pretty_assertions = { workspace = true }
|
|
rcgen = { workspace = true }
|
|
tempfile = { workspace = true }
|
|
tokio = { workspace = true, features = ["test-util"] }
|
|
tokio-test = { workspace = true }
|
|
wiremock = { workspace = true }
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
doctest = false
|