Class InputTokenCountParams
-
- All Implemented Interfaces:
-
com.openai.core.Params
public final class InputTokenCountParams implements Params
Get input token counts
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classInputTokenCountParams.BuilderA builder for InputTokenCountParams.
public final classInputTokenCountParams.Bodypublic final classInputTokenCountParams.ConversationThe conversation that this response belongs to. Items from this conversation are prepended to
input_itemsfor this response request. Input items and output items from this response are automatically added to this conversation after this response completes.public final classInputTokenCountParams.InputText, image, or file inputs to the model, used to generate a response
public final classInputTokenCountParams.TextConfiguration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
public final classInputTokenCountParams.ToolChoiceHow the model should select which tool (or tools) to use when generating a response. See the
toolsparameter to see how to specify which tools the model can call.public final classInputTokenCountParams.TruncationThe truncation strategy to use for the model response. -
auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. -disabled(default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
-
Method Summary
Modifier and Type Method Description final Optional<InputTokenCountParams.Conversation>conversation()The conversation that this response belongs to. final Optional<InputTokenCountParams.Input>input()Text, image, or file inputs to the model, used to generate a response final Optional<String>instructions()A system (or developer) message inserted into the model's context. final Optional<String>model()Model ID used to generate the response, like gpt-4ooro3.final Optional<Boolean>parallelToolCalls()Whether to allow the model to run tool calls in parallel. final Optional<String>previousResponseId()The unique ID of the previous response to the model. final Optional<Reasoning>reasoning()gpt-5 and o-series models only Configuration options for reasoning models. final Optional<InputTokenCountParams.Text>text()Configuration options for a text response from the model. final Optional<InputTokenCountParams.ToolChoice>toolChoice()How the model should select which tool (or tools) to use when generating a response. final Optional<List<Tool>>tools()An array of tools the model may call while generating a response. final Optional<InputTokenCountParams.Truncation>truncation()The truncation strategy to use for the model response. final JsonField<InputTokenCountParams.Conversation>_conversation()Returns the raw JSON value of conversation. final JsonField<InputTokenCountParams.Input>_input()Returns the raw JSON value of input. final JsonField<String>_instructions()Returns the raw JSON value of instructions. final JsonField<String>_model()Returns the raw JSON value of model. final JsonField<Boolean>_parallelToolCalls()Returns the raw JSON value of parallelToolCalls. final JsonField<String>_previousResponseId()Returns the raw JSON value of previousResponseId. final JsonField<Reasoning>_reasoning()Returns the raw JSON value of reasoning. final JsonField<InputTokenCountParams.Text>_text()Returns the raw JSON value of text. final JsonField<InputTokenCountParams.ToolChoice>_toolChoice()Returns the raw JSON value of toolChoice. final JsonField<List<Tool>>_tools()Returns the raw JSON value of tools. final JsonField<InputTokenCountParams.Truncation>_truncation()Returns the raw JSON value of truncation. final Map<String, JsonValue>_additionalBodyProperties()final Headers_additionalHeaders()Additional headers to send with the request. final QueryParams_additionalQueryParams()Additional query param to send with the request. final InputTokenCountParams.BuildertoBuilder()final InputTokenCountParams.Body_body()Headers_headers()The full set of headers in the parameters, including both fixed and additional headers. QueryParams_queryParams()The full set of query params in the parameters, including both fixed and additional query params. Booleanequals(Object other)IntegerhashCode()StringtoString()final static InputTokenCountParamsnone()final static InputTokenCountParams.Builderbuilder()Returns a mutable builder for constructing an instance of InputTokenCountParams. -
-
Method Detail
-
conversation
final Optional<InputTokenCountParams.Conversation> conversation()
The conversation that this response belongs to. Items from this conversation are prepended to
input_itemsfor this response request. Input items and output items from this response are automatically added to this conversation after this response completes.
-
input
final Optional<InputTokenCountParams.Input> input()
Text, image, or file inputs to the model, used to generate a response
-
instructions
final Optional<String> instructions()
A system (or developer) message inserted into the model's context. When used along with
previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
-
model
final Optional<String> model()
Model ID used to generate the response, like
gpt-4ooro3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.
-
parallelToolCalls
final Optional<Boolean> parallelToolCalls()
Whether to allow the model to run tool calls in parallel.
-
previousResponseId
final Optional<String> previousResponseId()
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with
conversation.
-
reasoning
final Optional<Reasoning> reasoning()
gpt-5 and o-series models only Configuration options for reasoning models.
-
text
final Optional<InputTokenCountParams.Text> text()
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
toolChoice
final Optional<InputTokenCountParams.ToolChoice> toolChoice()
How the model should select which tool (or tools) to use when generating a response. See the
toolsparameter to see how to specify which tools the model can call.
-
tools
final Optional<List<Tool>> tools()
An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.
-
truncation
final Optional<InputTokenCountParams.Truncation> truncation()
The truncation strategy to use for the model response. -
auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. -disabled(default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
-
_conversation
final JsonField<InputTokenCountParams.Conversation> _conversation()
Returns the raw JSON value of conversation.
Unlike conversation, this method doesn't throw if the JSON field has an unexpected type.
-
_input
final JsonField<InputTokenCountParams.Input> _input()
Returns the raw JSON value of input.
Unlike input, this method doesn't throw if the JSON field has an unexpected type.
-
_instructions
final JsonField<String> _instructions()
Returns the raw JSON value of instructions.
Unlike instructions, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<String> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_parallelToolCalls
final JsonField<Boolean> _parallelToolCalls()
Returns the raw JSON value of parallelToolCalls.
Unlike parallelToolCalls, this method doesn't throw if the JSON field has an unexpected type.
-
_previousResponseId
final JsonField<String> _previousResponseId()
Returns the raw JSON value of previousResponseId.
Unlike previousResponseId, this method doesn't throw if the JSON field has an unexpected type.
-
_reasoning
final JsonField<Reasoning> _reasoning()
Returns the raw JSON value of reasoning.
Unlike reasoning, this method doesn't throw if the JSON field has an unexpected type.
-
_text
final JsonField<InputTokenCountParams.Text> _text()
Returns the raw JSON value of text.
Unlike text, this method doesn't throw if the JSON field has an unexpected type.
-
_toolChoice
final JsonField<InputTokenCountParams.ToolChoice> _toolChoice()
Returns the raw JSON value of toolChoice.
Unlike toolChoice, this method doesn't throw if the JSON field has an unexpected type.
-
_tools
final JsonField<List<Tool>> _tools()
Returns the raw JSON value of tools.
Unlike tools, this method doesn't throw if the JSON field has an unexpected type.
-
_truncation
final JsonField<InputTokenCountParams.Truncation> _truncation()
Returns the raw JSON value of truncation.
Unlike truncation, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalBodyProperties
final Map<String, JsonValue> _additionalBodyProperties()
-
_additionalHeaders
final Headers _additionalHeaders()
Additional headers to send with the request.
-
_additionalQueryParams
final QueryParams _additionalQueryParams()
Additional query param to send with the request.
-
toBuilder
final InputTokenCountParams.Builder toBuilder()
-
_body
final InputTokenCountParams.Body _body()
-
_headers
Headers _headers()
The full set of headers in the parameters, including both fixed and additional headers.
-
_queryParams
QueryParams _queryParams()
The full set of query params in the parameters, including both fixed and additional query params.
-
none
final static InputTokenCountParams none()
-
builder
final static InputTokenCountParams.Builder builder()
Returns a mutable builder for constructing an instance of InputTokenCountParams.
-
-
-
-