请求
{
"messages": [
{
"content": "\n\n",
"role": "system"
},
{
"content": "打开百度",
"role": "user"
}
],
"model": "gpt-4.1",
"stream": false,
"temperature": 0.0,
"tools": [
{
"type": "function",
"function": {
"name": "browser_close",
"description": "Close the page",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_resize",
"description": "Resize the browser window",
"parameters": {
"type": "object",
"properties": {
"width": {
"type": "number",
"description": "Width of the browser window"
},
"height": {
"type": "number",
"description": "Height of the browser window"
}
},
"required": [
"width",
"height"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_console_messages",
"description": "Returns all console messages",
"parameters": {
"type": "object",
"properties": {
"onlyErrors": {
"type": "boolean",
"description": "Only return error messages"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_handle_dialog",
"description": "Handle a dialog",
"parameters": {
"type": "object",
"properties": {
"accept": {
"type": "boolean",
"description": "Whether to accept the dialog."
},
"promptText": {
"type": "string",
"description": "The text of the prompt in case of a prompt dialog."
}
},
"required": [
"accept"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_evaluate",
"description": "Evaluate JavaScript expression on page or element",
"parameters": {
"type": "object",
"properties": {
"function": {
"type": "string",
"description": "() => { /* code */ } or (element) => { /* code */ } when element is provided"
},
"element": {
"type": "string",
"description": "Human-readable element description used to obtain permission to interact with the element"
},
"ref": {
"type": "string",
"description": "Exact target element reference from the page snapshot"
}
},
"required": [
"function"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_file_upload",
"description": "Upload one or multiple files",
"parameters": {
"type": "object",
"properties": {
"paths": {
"type": "array",
"items": {
"type": "string"
},
"description": "The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled."
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_fill_form",
"description": "Fill multiple form fields",
"parameters": {
"type": "object",
"properties": {
"fields": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Human-readable field name"
},
"type": {
"type": "string",
"enum": [
"textbox",
"checkbox",
"radio",
"combobox",
"slider"
],
"description": "Type of the field"
},
"ref": {
"type": "string",
"description": "Exact target field reference from the page snapshot"
},
"value": {
"type": "string",
"description": "Value to fill in the field. If the field is a checkbox, the value should be `true` or `false`. If the field is a combobox, the value should be the text of the option."
}
},
"required": [
"name",
"type",
"ref",
"value"
],
"additionalProperties": false
},
"description": "Fields to fill in"
}
},
"required": [
"fields"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_install",
"description": "Install the browser specified in the config. Call this if you get an error about the browser not being installed.",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_press_key",
"description": "Press a key on the keyboard",
"parameters": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "Name of the key to press or a character to generate, such as `ArrowLeft` or `a`"
}
},
"required": [
"key"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_type",
"description": "Type text into editable element",
"parameters": {
"type": "object",
"properties": {
"element": {
"type": "string",
"description": "Human-readable element description used to obtain permission to interact with the element"
},
"ref": {
"type": "string",
"description": "Exact target element reference from the page snapshot"
},
"text": {
"type": "string",
"description": "Text to type into the element"
},
"submit": {
"type": "boolean",
"description": "Whether to submit entered text (press Enter after)"
},
"slowly": {
"type": "boolean",
"description": "Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once."
}
},
"required": [
"element",
"ref",
"text"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_navigate",
"description": "Navigate to a URL",
"parameters": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The URL to navigate to"
}
},
"required": [
"url"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_navigate_back",
"description": "Go back to the previous page",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_network_requests",
"description": "Returns all network requests since loading the page",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_take_screenshot",
"description": "Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.",
"parameters": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"png",
"jpeg"
],
"default": "png",
"description": "Image format for the screenshot. Default is png."
},
"filename": {
"type": "string",
"description": "File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory."
},
"element": {
"type": "string",
"description": "Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too."
},
"ref": {
"type": "string",
"description": "Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too."
},
"fullPage": {
"type": "boolean",
"description": "When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots."
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_snapshot",
"description": "Capture accessibility snapshot of the current page, this is better than screenshot",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_click",
"description": "Perform click on a web page",
"parameters": {
"type": "object",
"properties": {
"element": {
"type": "string",
"description": "Human-readable element description used to obtain permission to interact with the element"
},
"ref": {
"type": "string",
"description": "Exact target element reference from the page snapshot"
},
"doubleClick": {
"type": "boolean",
"description": "Whether to perform a double click instead of a single click"
},
"button": {
"type": "string",
"enum": [
"left",
"right",
"middle"
],
"description": "Button to click, defaults to left"
},
"modifiers": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Alt",
"Control",
"ControlOrMeta",
"Meta",
"Shift"
]
},
"description": "Modifier keys to press"
}
},
"required": [
"element",
"ref"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_drag",
"description": "Perform drag and drop between two elements",
"parameters": {
"type": "object",
"properties": {
"startElement": {
"type": "string",
"description": "Human-readable source element description used to obtain the permission to interact with the element"
},
"startRef": {
"type": "string",
"description": "Exact source element reference from the page snapshot"
},
"endElement": {
"type": "string",
"description": "Human-readable target element description used to obtain the permission to interact with the element"
},
"endRef": {
"type": "string",
"description": "Exact target element reference from the page snapshot"
}
},
"required": [
"startElement",
"startRef",
"endElement",
"endRef"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_hover",
"description": "Hover over element on page",
"parameters": {
"type": "object",
"properties": {
"element": {
"type": "string",
"description": "Human-readable element description used to obtain permission to interact with the element"
},
"ref": {
"type": "string",
"description": "Exact target element reference from the page snapshot"
}
},
"required": [
"element",
"ref"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_select_option",
"description": "Select an option in a dropdown",
"parameters": {
"type": "object",
"properties": {
"element": {
"type": "string",
"description": "Human-readable element description used to obtain permission to interact with the element"
},
"ref": {
"type": "string",
"description": "Exact target element reference from the page snapshot"
},
"values": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of values to select in the dropdown. This can be a single value or multiple values."
}
},
"required": [
"element",
"ref",
"values"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_tabs",
"description": "List, create, close, or select a browser tab.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"list",
"new",
"close",
"select"
],
"description": "Operation to perform"
},
"index": {
"type": "number",
"description": "Tab index, used for close/select. If omitted for close, current tab is closed."
}
},
"required": [
"action"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
},
{
"type": "function",
"function": {
"name": "browser_wait_for",
"description": "Wait for text to appear or disappear or a specified time to pass",
"parameters": {
"type": "object",
"properties": {
"time": {
"type": "number",
"description": "The time to wait in seconds"
},
"text": {
"type": "string",
"description": "The text to wait for"
},
"textGone": {
"type": "string",
"description": "The text to wait for to disappear"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
}
]
}
响应
{
"id": "chatcmpl-CS0GyJKnUjwzot0i1Fa4K91sE1pwG",
"object": "chat.completion",
"created": 1760790268,
"model": "gpt-4.1-2025-04-14",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_Qmxw3zynsDtwAGLOqjV4BAd2",
"type": "function",
"function": {
"name": "browser_navigate",
"arguments": "{\"url\":\"https://www.baidu.com\"}"
}
}
],
"refusal": null,
"annotations": []
},
"logprobs": null,
"finish_reason": "tool_calls"
}
],
"usage": {
"prompt_tokens": 1321,
"completion_tokens": 19,
"total_tokens": 1340,
"prompt_tokens_details": {
"cached_tokens": 0,
"audio_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"audio_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
},
"service_tier": "default",
"system_fingerprint": "fp_e24a1fec47"
}