Skip to navigation

Create a Guarded Response

View as MarkdownOpen in Claude

This page describes the built-in native OpenAI guard boundary at an example URL. Provider mounts and path prefixes can change the route. Set store to false and stream to true for SSE. Enabled Rails checks depend on configuration.

Inspect the request, response, and stream guard declarations. The parameter list omits disabled fields; the request contract retains their declarations.

See field-policy meanings, supported input and output, and streaming completion and errors. Field types describe gateway validation; consult the provider reference for upstream requirements. Replace example-model with a model available from your provider.

Request

Request fields describe the gateway guard boundary. Provider requirements apply separately.

Unlisted fields and case aliases of declared fields are rejected by default.

inputstringRequired>=1 character

Guarded Text selected for input checks when enabled in the Rails configuration.

storefalseRequired

Constrained The gateway enforces the declared value and shape restrictions.

backgroundfalseOptionalDefaults to false

Constrained The gateway enforces the declared value and shape restrictions.

max_output_tokensanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

max_tool_callsanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

metadataanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

modelanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

moderationanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

parallel_tool_callsanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

prompt_cache_keyanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

prompt_cache_optionsobject or nullOptional

Constrained The gateway enforces the declared value and shape restrictions.

prompt_cache_retentionanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

reasoningobject or nullOptional

Constrained The gateway enforces the declared value and shape restrictions.

safety_identifieranyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

service_tieranyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

streambooleanOptionalDefaults to false

Constrained The gateway enforces the declared value and shape restrictions.

stream_optionsanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

temperatureanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

textobject or nullOptional

Constrained The gateway enforces the declared value and shape restrictions.

top_logprobsinteger or nullOptional=0

Constrained The gateway enforces the declared value and shape restrictions.

top_panyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

truncationanyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

useranyOptional

Opaque Forwarded without inspecting or validating its value or nested contents. Provider requirements still apply.

Response

Provider-native JSON or SSE. The JSON example is an illustrative excerpt. Output restrictions apply only when output inspection is enabled. After SSE headers, failures are reported in the stream rather than by changing the HTTP status.

Errors

400
Bad Request Error
405
Method Not Allowed Error
413
Content Too Large Error
415
Unsupported Media Type Error
422
Unprocessable Entity Error
502
Bad Gateway Error