// Copyright (c) 2025-2026 libaxuan // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. package models import "encoding/json" // ResponseRequest OpenAI Responses API request type ResponseRequest struct { Model string `json:"model" binding:"required"` Input json.RawMessage `json:"input,omitempty"` Instructions json.RawMessage `json:"instructions,omitempty"` Stream bool `json:"stream,omitempty"` Tools []map[string]interface{} `json:"tools,omitempty"` ToolChoice json.RawMessage `json:"tool_choice,omitempty"` Temperature *float64 `json:"temperature,omitempty"` TopP *float64 `json:"top_p,omitempty"` MaxOutputTokens *int `json:"max_output_tokens,omitempty"` User *string `json:"user,omitempty"` PreviousResponseID *string `json:"previous_response_id,omitempty"` Store *bool `json:"store,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` ParallelToolCalls *bool `json:"parallel_tool_calls,omitempty"` Text json.RawMessage `json:"text,omitempty"` Reasoning json.RawMessage `json:"reasoning,omitempty"` MaxToolCalls *int `json:"max_tool_calls,omitempty"` Background *bool `json:"background,omitempty"` Conversation json.RawMessage `json:"conversation,omitempty"` Truncation string `json:"truncation,omitempty"` } // Response OpenAI Responses API response type Response struct { ID string `json:"id"` Object string `json:"object"` CreatedAt int64 `json:"created_at"` Status string `json:"status"` CompletedAt *int64 `json:"completed_at,omitempty"` Background *bool `json:"background,omitempty"` Error *ResponseError `json:"error,omitempty"` IncompleteDetails *ResponseIncompleteInfo `json:"incomplete_details,omitempty"` Instructions interface{} `json:"instructions,omitempty"` MaxOutputTokens *int `json:"max_output_tokens,omitempty"` MaxToolCalls *int `json:"max_tool_calls,omitempty"` Model string `json:"model"` Output []interface{} `json:"output"` OutputText string `json:"output_text,omitempty"` ParallelToolCalls bool `json:"parallel_tool_calls,omitempty"` PreviousResponseID *string `json:"previous_response_id,omitempty"` Reasoning *ResponseReasoning `json:"reasoning,omitempty"` Store *bool `json:"store,omitempty"` Temperature *float64 `json:"temperature,omitempty"` Text interface{} `json:"text,omitempty"` ToolChoice interface{} `json:"tool_choice,omitempty"` Tools []map[string]interface{} `json:"tools,omitempty"` TopP *float64 `json:"top_p,omitempty"` Truncation string `json:"truncation,omitempty"` Usage *ResponseUsage `json:"usage,omitempty"` User *string `json:"user,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` } // ResponseError mirrors the Responses API error object type ResponseError struct { Message string `json:"message"` Type string `json:"type,omitempty"` Code string `json:"code,omitempty"` } // ResponseIncompleteInfo mirrors the incomplete_details object type ResponseIncompleteInfo struct { Reason string `json:"reason,omitempty"` } // ResponseReasoning mirrors the reasoning config on responses type ResponseReasoning struct { Effort *string `json:"effort,omitempty"` Summary interface{} `json:"summary,omitempty"` } // ResponseUsage mirrors the usage object on responses type ResponseUsage struct { InputTokens int `json:"input_tokens"` OutputTokens int `json:"output_tokens"` TotalTokens int `json:"total_tokens"` OutputTokensDetails *ResponseOutputTokensDetails `json:"output_tokens_details,omitempty"` } // ResponseOutputTokensDetails mirrors output_tokens_details type ResponseOutputTokensDetails struct { ReasoningTokens int `json:"reasoning_tokens,omitempty"` } // ResponseOutputTextContent is an output_text content part type ResponseOutputTextContent struct { Type string `json:"type"` Text string `json:"text"` Annotations []interface{} `json:"annotations,omitempty"` Logprobs []interface{} `json:"logprobs,omitempty"` } // ResponseOutputMessage is a message output item type ResponseOutputMessage struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status,omitempty"` Role string `json:"role"` Content []ResponseOutputTextContent `json:"content"` } // ResponseFunctionCall is a function_call output item type ResponseFunctionCall struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status,omitempty"` CallID string `json:"call_id"` Name string `json:"name"` Arguments string `json:"arguments"` } // ResponseApplyPatchCall is an apply_patch_call output item type ResponseApplyPatchCall struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status,omitempty"` CallID string `json:"call_id"` Operation map[string]interface{} `json:"operation"` } // ResponseShellCall is a shell_call output item type ResponseShellCall struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status,omitempty"` CallID string `json:"call_id"` Action map[string]interface{} `json:"action"` Environment interface{} `json:"environment,omitempty"` } // ResponseLocalShellCall is a local_shell_call output item type ResponseLocalShellCall struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status,omitempty"` CallID string `json:"call_id"` Action map[string]interface{} `json:"action"` }