Send account id when available (#1767)

For users with multiple accounts we need to specify the account to use.
This commit is contained in:
pakrym-oai
2025-07-31 15:40:19 -07:00
committed by GitHub
parent 6ce0a5875b
commit 0935e6a875
3 changed files with 21 additions and 2 deletions

View File

@@ -192,7 +192,7 @@ impl ModelClient {
loop {
attempt += 1;
let req_builder = self
let mut req_builder = self
.client
.post(format!("{base_url}/responses"))
.header("OpenAI-Beta", "responses=experimental")
@@ -201,6 +201,12 @@ impl ModelClient {
.header(reqwest::header::ACCEPT, "text/event-stream")
.json(&payload);
if auth.mode == AuthMode::ChatGPT {
if let Some(account_id) = auth.get_account_id().await {
req_builder = req_builder.header("chatgpt-account-id", account_id);
}
}
let req_builder = self.provider.apply_http_headers(req_builder);
let res = req_builder.send().await;