Skip to navigation

Create a Guarded Chat Completion

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 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.

messageslist of objectsRequired

Guarded Container leading to text selected for input checks when enabled in the Rails configuration.

frequency_penaltyanyOptional

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

logit_biasanyOptional

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

logprobsfalse or nullOptional

Constrained The gateway enforces the declared value and shape restrictions.

max_completion_tokensanyOptional

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

max_tokensanyOptional

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.

nintegerOptionalDefaults to 1

Constrained The gateway enforces the declared value and shape restrictions.

presence_penaltyanyOptional

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_optionsanyOptional

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

prompt_cache_retentionanyOptional

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

reasoning_effortenum 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.

seedanyOptional

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.

stopanyOptional

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

storeanyOptional

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

streamboolean or nullOptionalDefaults 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.

top_panyOptional

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.

verbosityanyOptional

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