gcoai_request_body_params

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Set the Reasoning Effort for the completion request
  5. Since

Description

Filter to modify request body parameters before sending to OpenAI API.

Usage

Applied globally

add_filter( 'gcoai_request_body_params', 'my_custom_function' );

Applied to specific form

add_filter( 'gcoai_request_body_params_FORMID', 'my_custom_function' );

Parameters

$body array

The request body parameters.

$args array

Context arguments for the request.

url string

The full API endpoint URL

client Client

The Client instance making the request.

endpoint string

The specific endpoint being called.

Examples

Set the Reasoning Effort for the completion request

Adjust the reasoning_effort param sent with the request. See the Open API chat completions reference for available parameters for the model you are using.

add_filter( 'gcoai_request_body_params', function( $body_params, $args ) {
    $body_params['reasoning_effort'] = 'high';
    return $body_params;
}, 10, 2 );

Since

  • 1.0-beta-2.10 Hook added.