Versión en español:
vignette("errors-and-limits-es", package = "ellmercodex").
ChatGPT plan usage is not the same as the OpenAI API: it is a preview with its own limits, and some API features are not available. This article lists what is not supported and shows how to handle errors in code that runs unattended, such as scheduled scripts or Shiny apps.
What is not supported
ellmercodex supports interactive use of one conversation
at a time through ellmer’s Chat object
(ellmer 0.5.0 or later). These are not supported:
-
parallel_chat()andbatch_chat(). ChatGPT plan usage only works with streaming, soellmer’s parallel and batch helpers are outside the supported scope. -
Excluded request arguments. The preview rejects
temperature,top_p,max_tokens(max_output_tokens),metadata, andprevious_response_id, among others.ellmercodexfails before sending a request that uses them. - Provider token counting and file management. These fail before any request is sent.
Plan limits and supported features may change while the preview lasts.
Handle errors
ellmercodex signals structured conditions, so your code
can react to the kind of error without parsing messages:
tryCatch(
chat$chat("Hello"),
codex_auth_error = function(error) {
message("Authentication failed; run codex_login() again.")
},
codex_usage_limit_error = function(error) {
message("The ChatGPT plan's usage limit was reached; try again later.")
},
codex_network_error = function(error) {
message("Network error; check your connection and retry.")
},
codex_protocol_changed_error = function(error) {
message("The upstream protocol may have changed; update ellmercodex.")
},
error = function(error) {
message("The request failed: ", conditionMessage(error))
}
)Handle the most specific condition first. The main classes are:
-
codex_auth_error: the parent of all sign-in and credential errors, such as missing, malformed, or expired credentials. - Errors while talking to the service:
codex_network_error,codex_authentication_error,codex_rate_limit_error,codex_server_error,codex_model_unavailable_error,codex_malformed_request_error,codex_protocol_error, andcodex_protocol_changed_error, which means the shape of the service’s response may have changed. - ChatGPT plan errors, which also carry one of the classes above:
codex_usage_limit_error(the plan’s usage limit was reached; also acodex_rate_limit_error),codex_usage_unavailable_error(plan usage is temporarily unavailable; also acodex_server_error), andcodex_plan_ineligible_error(the account or workspace is not eligible; also acodex_authentication_error). -
codex_chat_errorandcodex_chat_argument_error: problems on theellmerside, such as an unsupported argument.
The full list is in ?ellmercodex-conditions.
