You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2b79a02
Browse filesBrowse the repository at this point in the historyBrowse files
jun
committed
docs(images): state the xAI relay credential mode, provider precedence, and result URL contract
Closes the two documentation-boundary items from the exact-head review of
842170b: the Grok grant is used only with authMode oauth (API key
otherwise), an explicit images.provider owns /v1/images and never falls
back to xAI, and URL results are fetched credentialless over public HTTPS
with no redirects, a 50 MiB per-file cap, and authenticated artifact
retrieval. Same facts mirrored into ja/ko/zh-cn/ru.
fails closed and never falls back to a different paid upstream. Registry-managed provider ids
57
57
are not accepted here; omit `images.provider` to use the built-in OpenAI tiers.
58
-
-**xAI Imagine (Grok OAuth) relay:** when `images.bridgeEnabled` is `true` and an `xai` provider
59
-
has a usable Grok CLI OAuth token (`ocx login xai`) or API key, `/v1/images/generations` and
60
-
`/v1/images/edits` are sent to `https://api.x.ai/v1` with that token. ChatGPT credentials are
61
-
not forwarded. If the token is missing, the proxy returns 400 instead of billing ChatGPT.
58
+
-**xAI Imagine (Grok OAuth) relay:** when `images.bridgeEnabled` is `true`, `images.provider` is
59
+
omitted, and an `xai` provider is configured, `/v1/images/generations` and `/v1/images/edits`
60
+
are sent to `https://api.x.ai/v1`. The credential depends on the provider's `authMode`: with
61
+
`"oauth"` the relay reuses the Grok CLI grant from `ocx login xai`; with any other mode it uses
62
+
the provider's API key. An OAuth login does not arm a keyed provider, and vice versa. ChatGPT
63
+
credentials are not forwarded. If the credential is missing, the proxy returns 400 instead of
64
+
billing ChatGPT. Setting `images.provider` explicitly hands `/v1/images` to that provider; its
65
+
own validation errors are returned as-is and the xAI relay is never tried.
62
66
The relay maps Codex `size` / `aspect_ratio` onto xAI's Imagine body and returns
63
67
the same `{created, data:[{b64_json}]}` shape. Combined decoded bytes and base64-encoded output
64
68
across the batch (inline `b64_json` and downloaded URLs) stay under 100 MiB; a batch that would
65
-
exceed that cap returns 502. This is independent of the Responses Image Bridge loop (which
66
-
remains API-key-only).
69
+
exceed that cap returns 502. When xAI returns an image URL instead of inline bytes, the proxy
70
+
fetches it itself with no credential: the URL must be public HTTPS (no redirects, no
71
+
`file:`, no loopback or private addresses), each download is capped at 50 MiB, and the result is
72
+
materialized as a local artifact that is served only through the authenticated management
73
+
endpoint. This is independent of the Responses Image Bridge loop (which remains API-key-only).
67
74
-**Google Antigravity (CCA) fallback:** when neither an OpenAI forward candidate nor a keyed
68
75
provider is configured, `/v1/images/generations` (not `/images/edits`) falls back to the
69
76
Antigravity **Cloud Code Assist** endpoint using the `gemini-3.1-flash-image` model. The fallback
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/ko/guides/codex-integration.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Codex의 내장 `image_gen` 도구는 `/v1/responses`를 거치지 않습니다.
37
37
-**모드 인식 forward 후보 하나:** Pool은 적격한 메인/추가 계정을 선택하고, Direct는 호출자 OAuth bearer를 사용합니다. 설정된 모드는 이미지 요청에도 일관되게 적용됩니다.
38
38
-**OpenAI API-key provider:** forward 후보 중 누구도 인증 실패를 가지지 않을 때만 사용합니다. 고장 나거나 만료된 Pool credential을 별도로 청구되는 API 사용 뒤에 숨기지 않습니다.
39
39
-**명시적 커스텀 provider:**`images.provider`를 OpenAI Images API를 구현한 커스텀 API-key `openai-responses` provider id로 설정할 수 있습니다. 명시적으로 선택한 provider는 닫힌 상태로 실패하며, 다른 유료 upstream으로 fallback하지 않습니다. registry-managed provider id는 여기서 허용하지 않습니다. 기본 제공 OpenAI tiers를 쓰려면 `images.provider`를 생략하세요.
40
-
-**xAI Imagine (Grok OAuth) relay:**`images.bridgeEnabled`가 `true`이고 `xai` provider에 사용 가능한 Grok CLI OAuth 토큰(`ocx login xai`) 또는 API key가 있으면 `/v1/images/generations`와 `/v1/images/edits`가 그 토큰으로 `https://api.x.ai/v1`에 전송됩니다. ChatGPT credential은 전달되지 않습니다. 토큰이 없으면 프록시는 ChatGPT에 과금하지 않고 400을 반환합니다. relay는 Codex `size` / `aspect_ratio`를 xAI Imagine body에 매핑하고 같은 `{created, data:[{b64_json}]}` 형태를 반환합니다. 배치 전체(인라인 `b64_json`과 내려받은 URL)의 디코드 바이트와 base64 인코드 출력은 합쳐서 100 MiB 미만입니다. 한도를 넘는 배치는 502를 반환합니다. 이 경로는 API-key-only Responses Image Bridge 루프와 별개입니다.
40
+
- **xAI Imagine (Grok OAuth) relay:** `images.bridgeEnabled`가 `true`이고 `images.provider`가 비어 있으며 `xai` provider가 설정되어 있으면 `/v1/images/generations`와 `/v1/images/edits`가 `https://api.x.ai/v1`로 전송됩니다. 어떤 credential을 쓰는지는 provider의 `authMode`가 정합니다. `"oauth"`면 `ocx login xai`로 받은 Grok CLI grant를 재사용하고, 그 외에는 provider의 API key를 씁니다. OAuth 로그인이 key 방식 provider를 활성화하지는 않으며 반대도 마찬가지입니다. ChatGPT credential은 전달되지 않습니다. credential이 없으면 프록시는 ChatGPT에 과금하지 않고 400을 반환합니다. `images.provider`를 명시하면 `/v1/images`는 그 provider가 맡고, 그 provider의 검증 오류가 그대로 반환되며 xAI relay는 시도되지 않습니다. relay는 Codex `size` / `aspect_ratio`를 xAI Imagine body에 매핑하고 같은 `{created, data:[{b64_json}]}` 형태를 반환합니다. 배치 전체(인라인 `b64_json`과 내려받은 URL)의 디코드 바이트와 base64 인코드 출력은 합쳐서 100 MiB 미만입니다. 한도를 넘는 배치는 502를 반환합니다. xAI가 인라인 바이트 대신 이미지 URL을 돌려주면 프록시가 credential 없이 직접 내려받습니다. URL은 공개 HTTPS여야 하고(리다이렉트, `file:`, loopback·사설 주소 불가), 파일당 50 MiB 상한이 있으며, 결과는 로컬 artifact로 저장되어 인증된 management endpoint로만 제공됩니다. 이 경로는 API-key-only Responses Image Bridge 루프와 별개입니다.
41
41
-**Google Antigravity (CCA) fallback:** OpenAI forward 후보도 keyed provider도 없을 때, `/v1/images/generations`(`/images/edits`는 제외)는 `gemini-3.1-flash-image` 모델을 사용해서 Antigravity **Cloud Code Assist** endpoint로 fallback합니다. OpenAI 인증 해석이 실패할 때(예: 만료되었거나 누락된 ChatGPT credential)에도 이 fallback이 동작하며, OpenAI 후보가 아예 없을 때만 발생하는 것은 아닙니다. 이 기능은 `ocx login google-antigravity`를 필요로 합니다. OAuth token은 오직 고정된 CCA registry host로만 전송되며, config-level `baseUrl` override로는 가지 않습니다. 응답은 Codex가 기대하는 `{created, data:[{b64_json}]}` 형식으로 반환됩니다.
42
42
-**둘 다 없음:** 프록시는 generic 404 대신 명확한 오류를 반환합니다. 라우팅되는 provider(Cursor, Gemini, Kiro 등)는 `image_generation` tool relay를 제공할 수 없습니다. 이 도구를 아예 노출하고 싶지 않다면 Codex에서 `codex features disable image_generation`(`config.toml`의 `[features] image_generation = false`)으로 끄세요.
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/ru/guides/codex-integration.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ reference-image), используя тот же bearer ChatGPT, что и дл
59
59
провал жёсткий: никакого fallback на другой платный upstream нет. Id провайдера, управляемые
60
60
registry, здесь не принимаются; если хотите использовать встроенные уровни OpenAI, опустите
61
61
`images.provider`.
62
-
-**Relay xAI Imagine (Grok OAuth):** если `images.bridgeEnabled` равно `true` и у провайдера `xai` есть действующий OAuth-токен Grok CLI (`ocx login xai`) или API-ключ, `/v1/images/generations` и `/v1/images/edits` уходят на `https://api.x.ai/v1` с этим токеном. Учётные данные ChatGPT не пересылаются. Если токена нет, прокси возвращает 400 и не тарифицирует ChatGPT. Relay отображает Codex `size` / `aspect_ratio` на тело Imagine и возвращает ту же форму `{created, data:[{b64_json}]}`. Суммарные декодированные байты и base64-выход партии (inline `b64_json` и скачанные URL) остаются ниже 100 MiB; превышение даёт 502. Это отдельно от цикла Responses Image Bridge, который по-прежнему только с API-ключом.
62
+
- **Relay xAI Imagine (Grok OAuth):** если `images.bridgeEnabled` равно `true`, `images.provider` не задан и настроен провайдер `xai`, `/v1/images/generations` и `/v1/images/edits` уходят на `https://api.x.ai/v1`. Какие учётные данные используются, определяет `authMode` провайдера: при `"oauth"` relay переиспользует грант Grok CLI из `ocx login xai`, в любом другом режиме — API-ключ провайдера. OAuth-вход не активирует провайдер с ключом, и наоборот. Учётные данные ChatGPT не пересылаются. Если учётных данных нет, прокси возвращает 400 и не тарифицирует ChatGPT. Явно заданный `images.provider` забирает `/v1/images` себе: его ошибки валидации возвращаются как есть, relay xAI не пробуется. Relay отображает Codex `size` / `aspect_ratio` на тело Imagine и возвращает ту же форму `{created, data:[{b64_json}]}`. Суммарные декодированные байты и base64-выход партии (inline `b64_json` и скачанные URL) остаются ниже 100 MiB; превышение даёт 502. Если xAI возвращает URL изображения вместо байтов, прокси скачивает его сам без учётных данных: URL должен быть публичным HTTPS (без редиректов, `file:`, loopback и приватных адресов), каждый файл ограничен 50 MiB, а результат сохраняется как локальный артефакт и отдаётся только через аутентифицированный management-эндпоинт. Это отдельно от цикла Responses Image Bridge, который по-прежнему только с API-ключом.
63
63
-**Fallback Google Antigravity (CCA):** если не настроен ни один OpenAI forward-candidate и ни
64
64
один keyed provider, `/v1/images/generations` (но не `/images/edits`) переходит на endpoint
65
65
Antigravity **Cloud Code Assist** с моделью `gemini-3.1-flash-image`. Этот fallback также
0 commit comments