> For the complete documentation index, see [llms.txt](https://docs.aimlapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aimlapi.com/api-references/text-models-llm/tencent/hy4-flash.md).

# Hy4 Flash

## Hy4 Flash

### description: "Model id: tencent/hy4-flash. Hy4 is the official release of Tencent’s Hy4 model, succeeding Hy4 preview with stronger agentic capabilities and better performance on long-horizon, real-world productivity tasks."

## Hy4

{% columns %}
{% column width="66.66666666666666%" %}
{% hint style="info" %}
This documentation is valid for the following list of our models:

* `tencent/hy4-flash`
  {% endhint %}
  {% endcolumn %}

{% column width="33.33333333333334%" %} <a href="https://aimlapi.com/app/tencent/hy4-flash" class="button primary">Try in Playground</a>
{% endcolumn %}
{% endcolumns %}

### Model Overview

Hy4 flash is a cost-efficient variant of Tencent’s Hy4, with roughly a quarter of the flagship’s parameter count for lower latency and cost. It targets code assistance and agentic workflows, accepts text and image input, has a 1M-token context window and configurable reasoning effort.

{% hint style="success" %}
[Create AI/ML API Key](https://aimlapi.com/app/keys)
{% endhint %}

<details>

<summary>How to make the first API call</summary>

**1️⃣ Required setup (don’t skip this)**\
▪ **Create an account:** Sign up on the AI/ML API website (if you don’t have one yet).\
▪ **Generate an API key:** In your account dashboard, create an API key and make sure it’s **enabled** in the UI.

**2️ Copy the code example**\
At the bottom of this page, pick the snippet for your preferred programming language (Python / Node.js) and copy it into your project.

**3️ Update the snippet for your use case**\
▪ **Insert your API key:** replace `<YOUR_AIMLAPI_KEY>` with your real AI/ML API key.\
▪ **Select a model:** set the `model` field to the model you want to call.\
▪ **Provide input:** fill in the request input field(s) shown in the example (for example, `messages` for chat/LLM models, or other inputs for image/video/audio models).

**4️ (Optional) Tune the request**\
Depending on the model type, you can add optional parameters to control the output (e.g., generation settings, quality, length, etc.). See the API schema below for the full list.

**5️ Run your code**\
Run the updated code in your development environment. Response time depends on the model and request size, but simple requests typically return quickly.

{% hint style="success" %}
If you need a more detailed walkthrough for setting up your development environment and making a request step by step — feel free to use our [Quickstart guide](broken://pages/ngeSCZKxiGVWqYZTHDjY).
{% endhint %}

</details>

### API Schemas

## POST /v1/chat/completions

>

```json
{"openapi":"3.0.0","info":{"title":"AIML API","version":"1.0.0"},"servers":[{"url":"https://api.aimlapi.com"}],"paths":{"/v1/chat/completions":{"post":{"operationId":"_v1_chat_completions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["tencent/hy4-flash"]},"provider":{"type":"string","description":"Provider routing override. Use a source key such as `openai`, `opentree`, `xai`, `google`, `alibaba`, `minimax`, `moonshot`, `baidu`, or `togetherai` to run that provider with no fallback; `auto` (default) uses the full fallback chain. Case-insensitive."},"messages":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"role":{"type":"string","enum":["user"],"description":"The role of the author of the message — in this case, the user"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image_url"]},"image_url":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string"}],"description":"Either a URL of the image or the base64 encoded image data. "},"detail":{"type":"string","enum":["low","high","auto"],"description":"Specifies the detail level of the image. Currently supports JPG/JPEG, PNG, GIF, and WEBP formats."}},"required":["url"]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","image_url"]}]}}],"description":"The contents of the user message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]}}],"description":"The contents of the developer message."},"role":{"type":"string","enum":["developer"],"description":"The role of the author of the message — in this case, the developer."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["content","role"]},{"type":"object","properties":{"role":{"type":"string","enum":["system"],"description":"The role of the author of the message — in this case, the system."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]}}],"description":"The contents of the system message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["tool"],"description":"The role of the author of the message — in this case, the tool."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]}}],"description":"The contents of the tool message."},"tool_call_id":{"type":"string","description":"Tool call that this message is responding to."},"name":{"type":"string","nullable":true,"description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content","tool_call_id"]},{"type":"object","properties":{"role":{"type":"string","enum":["assistant"],"description":"The role of the author of the message — in this case, the Assistant."},"content":{"anyOf":[{"type":"string","description":"The contents of the Assistant message."},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]},"description":"An array of content parts with a defined type. Can be one or more of type text, or exactly one of type refusal."},{"nullable":true}],"description":"The contents of the Assistant message. Required unless tool_calls or function_call is specified."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."},"tool_calls":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."},"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."}},"required":["name","arguments"],"description":"The function that the model called."},"extra_content":{"type":"object","additionalProperties":{"nullable":true},"description":"Opaque provider metadata for this tool call (e.g. Gemini thought_signature). Echo it back unchanged on the next turn."}},"required":["id","type","function"]},{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom tool to call."},"input":{"type":"string","description":"The input for the custom tool call generated by the model."}},"required":["name","input"],"description":"The custom tool that the model called."},"extra_content":{"type":"object","additionalProperties":{"nullable":true},"description":"Opaque provider metadata for this tool call (e.g. Gemini thought_signature). Echo it back unchanged on the next turn."}},"required":["id","type","custom"]}]},"description":"The tool calls generated by the model, such as function calls."},"refusal":{"type":"string","nullable":true,"description":"The refusal message by the Assistant."},"reasoning_content":{"type":"string","description":"The reasoning this model returned with this turn, handed back unchanged. Thinking models that ask for it (DeepSeek, Kimi, GLM, Qwen, and OpenRouter models whose reasoning is mandatory) refuse a tool-result turn without it."}},"required":["role"]}]},"description":"A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, documents (txt, pdf), images, and audio."},"max_completion_tokens":{"type":"integer","minimum":1,"description":"An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens."},"max_tokens":{"type":"number","minimum":1,"description":"The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API."},"stream":{"type":"boolean","default":false,"description":"If set to True, the model response data will be streamed to the client as it is generated using server-sent events."},"stream_options":{"type":"object","properties":{"include_usage":{"type":"boolean"}},"required":["include_usage"]},"temperature":{"type":"number","minimum":0,"maximum":2,"description":"What sampling temperature to use. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both."},"stop":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"nullable":true}],"description":"Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence."},"response_format":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of response format being defined. Always text."}},"required":["type"],"additionalProperties":false,"description":"Default response format. Used to generate text responses."},{"type":"object","properties":{"type":{"type":"string","enum":["json_object"],"description":"The type of response format being defined. Always json_object."}},"required":["type"],"additionalProperties":false,"description":"An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so."},{"type":"object","properties":{"type":{"type":"string","enum":["json_schema"],"description":"The type of response format being defined. Always json_schema."},"json_schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."},"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"The schema for the response format, described as a JSON Schema object."},"strict":{"type":"boolean","nullable":true,"description":"Whether to enable strict schema adherence when generating the output. If set to True, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is True."},"description":{"type":"string","description":"A description of what the response format is for, used by the model to determine how to respond in the format."}},"required":["name"],"additionalProperties":false,"description":"JSON Schema response format. Used to generate structured JSON responses."}},"required":["type","json_schema"],"additionalProperties":false,"description":"JSON Schema response format. Used to generate structured JSON responses."}],"description":"An object specifying the format that the model must output."},"tools":{"type":"array","items":{"anyOf":[{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function."},"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."},"parameters":{"type":"object","additionalProperties":{"nullable":true,"description":"The parameters the functions accepts, described as a JSON Schema object."}},"strict":{"type":"boolean","nullable":true,"description":"Whether to enable strict schema adherence when generating the function call. If set to True, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is True."}},"required":["name"]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","function"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom tool, used to identify it in tool calls."},"description":{"type":"string","description":"Optional description of the custom tool, used to provide more context."},"format":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["grammar"]},"grammar":{"type":"object","properties":{"definition":{"type":"string","description":"The grammar definition."},"syntax":{"type":"string","enum":["lark","regex"],"description":"The syntax of the grammar definition."}},"required":["definition","syntax"]}},"required":["type","grammar"]}],"description":"The input format for the custom tool. Default is unconstrained text."}},"required":["name","format"]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","custom"]}]},{"type":"object","properties":{"type":{"type":"string","minLength":1}},"required":["type"]}]},"description":"A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported."},"tool_choice":{"anyOf":[{"type":"string","enum":["none","auto","required"],"description":"none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools."},{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."}},"required":["name"]}},"required":["type","function"],"description":"Specifies a tool the model should use. Use to force the model to call a specific function."},{"type":"object","properties":{"type":{"type":"string","enum":["allowed_tools"],"description":"The type of the tool. Currently, only function is supported."},"allowed_tools":{"type":"object","properties":{"mode":{"type":"string","enum":["auto","required"],"description":"Constrains the tools available to the model to a pre-defined set.\n- auto allows the model to pick from among the allowed tools and generate a message.\n- required requires the model to call one or more of the allowed tools."},"tools":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}},"description":"A list of tool definitions that the model should be allowed to call."}},"required":["mode","tools"]}},"required":["type","allowed_tools"],"description":"Constrains the tools available to the model to a pre-defined set."},{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"string","enum":["name"],"description":"The name of the function to call."}},"required":["type","function"],"description":"Specifies a tool the model should use. Use to force the model to call a specific function."},{"type":"object","properties":{"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"string","enum":["name"],"description":"The name of the custom tool to call."}},"required":["type","custom"],"description":"Specifies a tool the model should use. Use to force the model to call a specific custom tool."}],"description":"Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {\"type\": \"function\", \"function\": {\"name\": \"my_function\"}} forces the model to call that tool.\n  none is the default when no tools are present. auto is the default if tools are present."},"normalize_tool_schemas":{"type":"boolean","description":"Enable provider compatibility normalization for tool function JSON schemas."},"reasoning_effort":{"type":"string","enum":["none","low","high"],"description":"Constrains effort on reasoning for reasoning models. Currently supported values are low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."},"reasoning":{"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high"],"description":"Reasoning effort setting"},"max_tokens":{"type":"integer","minimum":1,"description":"Max tokens of reasoning content. Cannot be used simultaneously with effort."},"exclude":{"type":"boolean","description":"Whether to exclude reasoning from the response"}},"description":"Configuration for model reasoning/thinking tokens"},"provider_options":{"type":"object","properties":{"order":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128},"minItems":1,"maxItems":32,"description":"Upstream provider slugs of the opentree provider to try first, in this order, e.g. [\"deepinfra/bf16\", \"together\"]. A bare slug matches every variant of that provider."},"only":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128},"minItems":1,"maxItems":32,"description":"Upstream provider slugs of the opentree provider to allow — every other upstream is excluded, e.g. [\"deepinfra/bf16\", \"together\"]. A bare slug matches every variant of that provider."},"ignore":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128},"minItems":1,"maxItems":32,"description":"Upstream provider slugs of the opentree provider to skip, e.g. [\"deepinfra/bf16\", \"together\"]. A bare slug matches every variant of that provider."},"allow_fallbacks":{"type":"boolean","description":"Whether the opentree provider may fall back to an upstream outside `order`/`only` when the preferred ones are unavailable. Default true; set false to fail instead."},"require_parameters":{"type":"boolean","description":"Only route to upstreams that support every parameter in this request. Default false."},"quantizations":{"type":"array","items":{"type":"string","enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"]},"minItems":1,"description":"Only route to upstreams serving one of these quantizations."},"sort":{"type":"string","enum":["price","throughput","latency"],"description":"Upstream ordering when `order` is not set. The opentree provider defaults to a price/uptime blend."},"data_collection":{"type":"string","enum":["allow","deny"],"description":"`deny` excludes upstreams that may store or train on prompts."},"zdr":{"type":"boolean","description":"Only route to Zero Data Retention upstreams."}},"additionalProperties":false,"description":"Upstream routing for the opentree provider. Applies only when the request is served through the opentree provider (pin `provider: \"opentree\"` to be sure); every other provider refuses it rather than ignore it."}},"required":["model","messages"],"title":"tencent/hy4-flash"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"A unique identifier for the chat completion."},"object":{"type":"string","enum":["chat.completion"],"description":"The object type."},"created":{"type":"number","description":"The Unix timestamp (in seconds) of when the chat completion was created."},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"number","description":"The index of the choice in the list of choices."},"message":{"type":"object","properties":{"role":{"type":"string","description":"The role of the author of this message."},"content":{"type":"string","description":"The contents of the message."},"refusal":{"type":"string","nullable":true,"description":"The refusal message generated by the model."},"annotations":{"type":"array","nullable":true,"items":{"type":"object","properties":{"type":{"type":"string","enum":["url_citation"],"description":"The type of the URL citation. Always url_citation."},"url_citation":{"type":"object","properties":{"end_index":{"type":"integer","description":"The index of the last character of the URL citation in the message."},"start_index":{"type":"integer","description":"The index of the first character of the URL citation in the message."},"title":{"type":"string","description":"The title of the web resource."},"url":{"type":"string","description":"The URL of the web resource."}},"required":["end_index","start_index","title","url"],"description":"A URL citation when using web search."}},"required":["type","url_citation"]},"description":"Annotations for the message, when applicable, as when using the web search tool."},"audio":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"Unique identifier for this audio response."},"data":{"type":"string","description":"Base64 encoded audio bytes generated by the model, in the format specified in the request."},"transcript":{"type":"string","description":"Transcript of the audio generated by the model."},"expires_at":{"type":"integer","description":"The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations."}},"required":["id","data","transcript","expires_at"],"description":"A chat completion message generated by the model."},"tool_calls":{"type":"array","nullable":true,"items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["function"],"description":"The type of the tool."},"function":{"type":"object","properties":{"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."},"name":{"type":"string","description":"The name of the function to call."}},"required":["arguments","name"],"description":"The function that the model called."}},"required":["id","type","function"]},{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["custom"],"description":"The type of the tool."},"custom":{"type":"object","properties":{"input":{"type":"string","description":"The input for the custom tool call generated by the model."},"name":{"type":"string","description":"The name of the custom tool to call."}},"required":["input","name"],"description":"The custom tool that the model called."}},"required":["id","type","custom"]}]},"description":"The tool calls generated by the model, such as function calls."}},"required":["role","content"],"description":"A chat completion message generated by the model."},"finish_reason":{"type":"string","enum":["stop","length","content_filter","tool_calls"],"description":"The reason the model stopped generating tokens. This will be stop if the model hit a natural stop point or a provided stop sequence, length if the maximum number of tokens specified in the request was reached, content_filter if content was omitted due to a flag from our content filters, tool_calls if the model called a tool"},"logprobs":{"type":"object","nullable":true,"properties":{"content":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"bytes":{"type":"array","nullable":true,"items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."}},"required":["logprob","token"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["bytes","logprob","token"]},"description":"A list of message content tokens with log probability information."},"refusal":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"bytes":{"type":"array","nullable":true,"items":{"type":"integer"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"token":{"type":"string","description":"The token."}},"required":["logprob","token"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["bytes","logprob","token"]},"description":"A list of message refusal tokens with log probability information."}},"required":["content","refusal"],"description":"Log probability information for the choice."}},"required":["index","message","finish_reason"]}},"model":{"type":"string","description":"The model used for the chat completion."},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"number","description":"Number of tokens in the prompt."},"completion_tokens":{"type":"number","description":"Number of tokens in the generated completion."},"total_tokens":{"type":"number","description":"Total number of tokens used in the request (prompt + completion)."},"completion_tokens_details":{"type":"object","nullable":true,"properties":{"accepted_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion."},"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens generated by the model."},"reasoning_tokens":{"type":"integer","nullable":true,"description":"Tokens generated by the model for reasoning."},"rejected_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits."}},"description":"Breakdown of tokens used in a completion."},"prompt_tokens_details":{"type":"object","nullable":true,"properties":{"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens present in the prompt."},"cached_tokens":{"type":"integer","nullable":true,"description":"Cached tokens present in the prompt."}},"description":"Breakdown of tokens used in the prompt."}},"required":["prompt_tokens","completion_tokens","total_tokens"],"description":"Usage statistics for the completion request."},"meta":{"type":"object","nullable":true,"properties":{"usage":{"type":"object","nullable":true,"properties":{"credits_used":{"type":"number","description":"The number of tokens consumed during generation."},"usd_spent":{"type":"number","description":"The total amount of money spent by the user in USD."}},"required":["credits_used","usd_spent"]}},"description":"Additional details about the generation."}},"required":["id","object","created","choices","model","usage"]}},"text/event-stream":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"A unique identifier for the chat completion."},"choices":{"type":"array","items":{"type":"object","properties":{"delta":{"type":"object","nullable":true,"properties":{"content":{"type":"string","description":"The contents of the chunk message."},"refusal":{"type":"string","nullable":true,"description":"The refusal message generated by the model."},"role":{"type":"string","enum":["user","assistant","developer","system","tool"],"description":"The role of the author of this message."},"tool_calls":{"type":"array","nullable":true,"items":{"type":"object","properties":{"index":{"type":"number"},"id":{"type":"string","description":"The ID of the tool call."},"function":{"type":"object","properties":{"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."},"name":{"type":"string"}},"required":["arguments","name"],"description":"The function that the model called."},"type":{"type":"string","enum":["function"],"description":"The type of the tool."}},"required":["index","id","function","type"]},"description":"The tool calls generated by the model, such as function calls."}},"required":["content","role"],"description":"A chat completion delta generated by streamed model responses."},"finish_reason":{"type":"string","enum":["length","function_call","stop","tool_calls","content_filter"]},"index":{"type":"number","description":"The index of the choice in the list of choices."},"logprobs":{"type":"object","nullable":true,"properties":{"content":{"type":"array","items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."}},"required":["token","bytes","logprob"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["token","bytes","logprob"]}},"refusal":{"type":"array","items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."},"top_logprobs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"token":{"type":"string","description":"The token."},"bytes":{"type":"array","items":{"type":"number"},"description":"A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token."},"logprob":{"type":"number","description":"The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely."}},"required":["token","bytes","logprob"]},"description":"List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned."}},"required":["token","bytes","logprob"]}}},"required":["content","refusal"],"description":"Log probability information for the choice."}},"required":["finish_reason","index"]},"description":"A list of chat completion choices. Can be more than one if n is greater than 1."},"created":{"type":"number","description":"The Unix timestamp (in seconds) of when the chat completion was created."},"model":{"type":"string","description":"The model used for the chat completion."},"object":{"type":"string","enum":["chat.completion.chunk"],"description":"The object type."},"service_tier":{"type":"string","nullable":true,"enum":["auto","default","flex","scale","priority"],"description":"Specifies the processing type used for serving the request."},"usage":{"type":"object","nullable":true,"properties":{"prompt_tokens":{"type":"number","description":"Number of tokens in the prompt."},"completion_tokens":{"type":"number","description":"Number of tokens in the generated completion."},"total_tokens":{"type":"number","description":"Total number of tokens used in the request (prompt + completion)."},"completion_tokens_details":{"type":"object","nullable":true,"properties":{"accepted_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion."},"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens generated by the model."},"reasoning_tokens":{"type":"integer","nullable":true,"description":"Tokens generated by the model for reasoning."},"rejected_prediction_tokens":{"type":"integer","nullable":true,"description":"When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits."}},"description":"Breakdown of tokens used in a completion."},"prompt_tokens_details":{"type":"object","nullable":true,"properties":{"audio_tokens":{"type":"integer","nullable":true,"description":"Audio input tokens present in the prompt."},"cached_tokens":{"type":"integer","nullable":true,"description":"Cached tokens present in the prompt."}},"description":"Breakdown of tokens used in the prompt."}},"required":["prompt_tokens","completion_tokens","total_tokens"],"description":"Usage statistics for the completion request."}},"required":["id","choices","created","model","object"]}}},"description":"Successful response."}}}}}}
```

## POST /v1/responses

>

```json
{"openapi":"3.0.0","info":{"title":"AIML API","version":"1.0.0"},"servers":[{"url":"https://api.aimlapi.com"}],"paths":{"/v1/responses":{"post":{"operationId":"_v1_responses","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["tencent/hy4-flash"]},"input":{"anyOf":[{"type":"string","description":"A text input to the model, equivalent to a text input with the user role."},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["message"],"description":"The type of the message input. Always message."},"role":{"type":"string","enum":["user","assistant","system","developer"],"description":"The role of the message input."},"content":{"anyOf":[{"type":"string","description":"A text input to the model."},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["input_text"],"description":"The type of the input item. Always input_text."},"text":{"type":"string","description":"The text input to the model."}},"required":["type","text"],"description":"A text input to the model."},{"type":"object","properties":{"type":{"type":"string","enum":["input_image"],"description":"The type of the input item. Always input_image."},"detail":{"type":"string","enum":["high","low","auto"],"default":"auto","description":"The detail level of the image to be sent to the model. One of high, low, or auto."},"image_url":{"type":"string","nullable":true,"description":"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["input_file"],"description":"The type of the input item. Always input_file."},"file_data":{"type":"string","description":"The content of the file to be sent to the model."},"filename":{"type":"string","description":"The name of the file to be sent to the model."}},"required":["type"]}]},"description":"A list of one or many input items to the model, containing different content types."}],"description":"Text, image, or audio input to the model, used to generate a response. Can also contain previous assistant responses."}},"required":["role","content"],"description":"A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role. Messages with the assistant role are presumed to have been generated by the model in previous interactions."},{"type":"object","properties":{"type":{"type":"string","enum":["message"],"description":"The type of the message input. Always message."},"role":{"type":"string","enum":["user","system","developer"],"description":"The role of the message input."},"status":{"type":"string","enum":["in_progress","completed","incomplete"],"description":"The status of item."},"content":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["input_text"],"description":"The type of the input item. Always input_text."},"text":{"type":"string","description":"The text input to the model."}},"required":["type","text"],"description":"A text input to the model."},{"type":"object","properties":{"type":{"type":"string","enum":["input_image"],"description":"The type of the input item. Always input_image."},"detail":{"type":"string","enum":["high","low","auto"],"default":"auto","description":"The detail level of the image to be sent to the model. One of high, low, or auto."},"image_url":{"type":"string","nullable":true,"description":"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["input_file"],"description":"The type of the input item. Always input_file."},"file_data":{"type":"string","description":"The content of the file to be sent to the model."},"filename":{"type":"string","description":"The name of the file to be sent to the model."}},"required":["type"]}]},"description":"A list of one or many input items to the model, containing different content types."}},"required":["role","content"],"description":"A message input to the model with a role indicating instruction following hierarchy. Instructions given with the developer or system role take precedence over instructions given with the user role."},{"type":"object","properties":{"id":{"type":"string","description":"The unique ID of the output message."},"role":{"type":"string","enum":["assistant"],"description":"The role of the output message. Always assistant."},"status":{"type":"string","enum":["in_progress","completed","incomplete"],"description":"The status of the message input."},"type":{"type":"string","enum":["message"],"description":"The type of the output message. Always message."},"content":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"annotations":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"end_index":{"type":"integer","description":"The index of the last character of the URL citation in the message."},"start_index":{"type":"integer","description":"The index of the first character of the URL citation in the message."},"title":{"type":"string","description":"The title of the web resource."},"type":{"type":"string","enum":["url_citation"],"description":"The type of the URL citation. Always url_citation."},"url":{"type":"string","format":"uri","description":"The URL of the web resource."}},"required":["end_index","start_index","title","type","url"],"description":"A citation for a web resource used to generate a model response."}]},"description":"The annotations of the text output."},"text":{"type":"string","description":"The text output from the model."},"type":{"type":"string","enum":["output_text"],"description":"The type of the output text. Always output_text."},"logprobs":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"}},"logprob":{"type":"number"},"token":{"type":"string"},"top_logprobs":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"}},"logprob":{"type":"number"},"token":{"type":"string"}},"required":["bytes","logprob","token"]}}},"required":["bytes","logprob","token","top_logprobs"]}}},"required":["annotations","text","type"]},{"type":"object","properties":{"refusal":{"type":"string","description":"The refusal explanationfrom the model."},"type":{"type":"string","enum":["refusal"],"description":"The type of the refusal. Always refusal."}},"required":["refusal","type"]}],"description":"The content of the output message."}}},"required":["id","role","status","type","content"],"description":"An output message from the model."},{"type":"object","properties":{"type":{"type":"string","enum":["message"],"description":"The type of the output message. Always message."},"role":{"type":"string","enum":["assistant"],"description":"The role of the output message. Always assistant."},"status":{"type":"string","enum":["in_progress","completed","incomplete"],"description":"The status of the message input."},"phase":{"type":"string","enum":["commentary","final_answer"],"description":"Whether the assistant message was intermediate commentary or the final answer of its turn."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"annotations":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"end_index":{"type":"integer","description":"The index of the last character of the URL citation in the message."},"start_index":{"type":"integer","description":"The index of the first character of the URL citation in the message."},"title":{"type":"string","description":"The title of the web resource."},"type":{"type":"string","enum":["url_citation"],"description":"The type of the URL citation. Always url_citation."},"url":{"type":"string","format":"uri","description":"The URL of the web resource."}},"required":["end_index","start_index","title","type","url"],"description":"A citation for a web resource used to generate a model response."}]},"description":"The annotations of the text output."},"text":{"type":"string","description":"The text output from the model."},"type":{"type":"string","enum":["output_text"],"description":"The type of the output text. Always output_text."},"logprobs":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"}},"logprob":{"type":"number"},"token":{"type":"string"},"top_logprobs":{"type":"array","items":{"type":"object","properties":{"bytes":{"type":"array","items":{"type":"integer"}},"logprob":{"type":"number"},"token":{"type":"string"}},"required":["bytes","logprob","token"]}}},"required":["bytes","logprob","token","top_logprobs"]}}},"required":["text","type"]},{"type":"object","properties":{"refusal":{"type":"string","description":"The refusal explanationfrom the model."},"type":{"type":"string","enum":["refusal"],"description":"The type of the refusal. Always refusal."}},"required":["refusal","type"]}]}}],"description":"The content of the output message."}},"required":["role","content"],"description":"An output message from the model."},{"type":"object","properties":{"type":{"type":"string","enum":["additional_tools"],"description":"The type of the input item. Always `additional_tools`."},"role":{"type":"string","enum":["developer"],"description":"The role of the item. Always `developer`."},"id":{"type":"string","nullable":true,"description":"Client-side id of the item."},"tools":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."},"parameters":{"type":"object","additionalProperties":{"nullable":true},"description":"A JSON schema object describing the parameters of the function."},"strict":{"anyOf":[{"type":"boolean"},{"nullable":true},{"nullable":true}],"description":"Whether to enforce strict parameter validation."},"type":{"type":"string","enum":["function"],"description":"The type of the function tool. Always function."},"description":{"type":"string","description":"A description of the function. Used by the model to determine whether or not to call the function."}},"required":["name","parameters","type"],"description":"Defines a function in your own code the model can choose to call."},{"type":"object","properties":{"type":{"type":"string","minLength":1}},"required":["type"]}]},"description":"Tool definitions, same schema as the top-level `tools` array. They are merged into `tools` before the request is dispatched."}},"required":["type","tools"],"description":"Extra tool definitions sent as an input item (Codex CLI). Merged into the top-level `tools` array before dispatch."},{"type":"object","properties":{"arguments":{"type":"string","description":"A JSON string of the arguments to pass to the function."},"call_id":{"type":"string","description":"The unique ID of the function tool call generated by the model."},"name":{"type":"string","description":"The name of the function to run."},"namespace":{"type":"string","description":"Namespace of the called tool, when it was declared inside a `namespace` tool."},"type":{"type":"string","enum":["function_call"],"description":"The type of the function tool call. Always function_call."},"id":{"type":"string","description":"The unique ID of the function tool call."},"status":{"type":"string","enum":["in_progress","completed","incomplete"],"description":"The status of the item."}},"required":["arguments","call_id","name","type"],"description":"A tool call to run a function."},{"type":"object","properties":{"call_id":{"type":"string","description":"The unique ID of the function tool call generated by the model."},"output":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["input_text"],"description":"The type of the input item. Always input_text."},"text":{"type":"string","description":"The text input to the model."}},"required":["type","text"],"description":"A text input to the model."},{"type":"object","properties":{"type":{"type":"string","enum":["input_image"],"description":"The type of the input item. Always input_image."},"detail":{"type":"string","enum":["high","low","auto"],"default":"auto","description":"The detail level of the image to be sent to the model. One of high, low, or auto."},"image_url":{"type":"string","nullable":true,"description":"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["input_file"],"description":"The type of the input item. Always input_file."},"file_data":{"type":"string","description":"The content of the file to be sent to the model."},"filename":{"type":"string","description":"The name of the file to be sent to the model."}},"required":["type"]}]}}],"description":"A JSON string of the output of the function tool call."},"type":{"type":"string","enum":["function_call_output"],"description":"The type of the function tool call output. Always function_call_output."},"id":{"type":"string","nullable":true,"description":"The unique ID of the function tool call output. Populated when this item is returned via API."},"status":{"type":"string","nullable":true,"enum":["in_progress","completed","incomplete"],"description":"The status of the item."}},"required":["call_id","output","type"],"description":"The output of a function tool call."},{"type":"object","properties":{"call_id":{"type":"string","description":"The unique ID of the custom tool call."},"input":{"type":"string","description":"The input the model produced for the tool."},"name":{"type":"string","description":"The name of the called custom tool."},"type":{"type":"string","enum":["custom_tool_call"],"description":"The type of the item. Always `custom_tool_call`."},"id":{"type":"string","description":"The ID of the item."},"namespace":{"type":"string","description":"Namespace of the called tool, when it was declared inside a `namespace` tool."},"status":{"type":"string","enum":["in_progress","completed","incomplete"],"description":"The status of the item."}},"required":["call_id","input","name","type"],"description":"A call to a custom tool."},{"type":"object","properties":{"call_id":{"type":"string","description":"The ID of the custom tool call this answers."},"output":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["input_text"],"description":"The type of the input item. Always input_text."},"text":{"type":"string","description":"The text input to the model."}},"required":["type","text"],"description":"A text input to the model."},{"type":"object","properties":{"type":{"type":"string","enum":["input_image"],"description":"The type of the input item. Always input_image."},"detail":{"type":"string","enum":["high","low","auto"],"default":"auto","description":"The detail level of the image to be sent to the model. One of high, low, or auto."},"image_url":{"type":"string","nullable":true,"description":"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["input_file"],"description":"The type of the input item. Always input_file."},"file_data":{"type":"string","description":"The content of the file to be sent to the model."},"filename":{"type":"string","description":"The name of the file to be sent to the model."}},"required":["type"]}]}}],"description":"The output of the custom tool: a string or a list of content parts."},"type":{"type":"string","enum":["custom_tool_call_output"],"description":"The type of the item. Always `custom_tool_call_output`."},"id":{"type":"string","nullable":true,"description":"The ID of the item."}},"required":["call_id","output","type"],"description":"The output of a custom tool call."},{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier of the reasoning content."},"summary":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string","description":"A short summary of the reasoning used by the model when generating the response."},"type":{"type":"string","enum":["summary_text"],"description":"The type of the object. Always summary_text."}},"required":["text","type"]},"description":"Reasoning text contents."},"type":{"type":"string","enum":["reasoning"],"description":"The type of the object. Always reasoning."},"encrypted_content":{"type":"string","nullable":true,"description":"The encrypted content of the reasoning item - populated when a response is generated with reasoning.encrypted_content in the include parameter."},"status":{"type":"string","enum":["in_progress","completed","incomplete"],"description":"The status of the item."}},"required":["summary","type"],"description":"A description of the chain of thought used by a reasoning model while generating a response."},{"type":"object","properties":{"id":{"type":"string","description":"The ID of the item to reference."},"type":{"type":"string","nullable":true,"enum":["item_reference"],"description":"The type of item to reference. Always item_reference."}},"required":["id"],"description":"An internal identifier for an item to reference."}]}}],"description":"Text, image, or file inputs to the model, used to generate a response."},"background":{"type":"boolean","default":false,"description":"Whether to run the model response in the background."},"instructions":{"type":"string","nullable":true,"description":"A system (or developer) message inserted into the model's context.\n\nWhen using 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."},"include":{"type":"array","nullable":true,"items":{"type":"string","enum":["message.input_image.image_url","computer_call_output.output.image_url","reasoning.encrypted_content","code_interpreter_call.outputs"]},"description":"Specify additional output data to include in the model response. Currently supported values are:\n- code_interpreter_call.outputs: Includes the outputs of python code execution in code interpreter tool call items.\n- computer_call_output.output.image_url: Include image urls from the computer call output.\n- file_search_call.results: Include the search results of the file search tool call.\n- message.output_text.logprobs: Include logprobs with assistant messages.\n- reasoning.encrypted_content: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the store parameter is set to false, or when an organization is enrolled in the zero data retention program).\n"},"max_output_tokens":{"type":"integer","minimum":16,"description":"An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens."},"previous_response_id":{"type":"string","nullable":true,"description":"The unique ID of the previous response to the model. Use this to create multi-turn conversations."},"prompt":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The unique identifier of the prompt template to use."},"variables":{"type":"object","nullable":true,"additionalProperties":{"anyOf":[{"type":"string"},{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["input_text"],"description":"The type of the input item. Always input_text."},"text":{"type":"string","description":"The text input to the model."}},"required":["type","text"],"description":"A text input to the model."},{"type":"object","properties":{"type":{"type":"string","enum":["input_image"],"description":"The type of the input item. Always input_image."},"detail":{"type":"string","enum":["high","low","auto"],"default":"auto","description":"The detail level of the image to be sent to the model. One of high, low, or auto."},"image_url":{"type":"string","nullable":true,"description":"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["input_file"],"description":"The type of the input item. Always input_file."},"file_data":{"type":"string","description":"The content of the file to be sent to the model."},"filename":{"type":"string","description":"The name of the file to be sent to the model."}},"required":["type"]}]}]},"description":"Optional map of values to substitute in for variables in your prompt. The substitution values can either be strings, or other Response input types like images or files."},"version":{"type":"string","nullable":true,"description":"Optional version of the prompt template."}},"required":["id"],"description":"Reference to a prompt template and its variables."},"store":{"type":"boolean","nullable":true,"default":false,"description":"Whether to store the generated model response for later retrieval via API."},"stream":{"type":"boolean","nullable":true,"default":false,"description":"If set to true, the model response data will be streamed to the client as it is generated using server-sent events. "},"text":{"type":"object","properties":{"format":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of response format being defined. Always text."}},"required":["type"],"additionalProperties":false,"description":"Default response format. Used to generate text responses."},{"type":"object","properties":{"type":{"type":"string","enum":["json_object"],"description":"The type of response format being defined. Always json_object."}},"required":["type"],"additionalProperties":false,"description":"An older method of generating JSON responses. Using json_schema is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so."},{"type":"object","properties":{"name":{"type":"string","description":"The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."},"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"The schema for the response format, described as a JSON Schema object."},"type":{"type":"string","enum":["json_schema"]},"strict":{"type":"boolean","nullable":true,"description":"Whether to enable strict schema adherence when generating the output. If set to True, the model will always follow the exact schema defined in the schema field. Only a subset of JSON Schema is supported when strict is True."},"description":{"type":"string","description":"A description of what the response format is for, used by the model to determine how to respond in the format."}},"required":["name","schema","type"],"description":"JSON Schema response format. Used to generate structured JSON responses."}],"default":{"type":"text"},"description":"An object specifying the format that the model must output."}},"description":"Configuration options for a text response from the model. Can be plain text or structured JSON data."},"truncation":{"type":"string","enum":["auto","disabled"],"default":"disabled","description":"The truncation strategy to use for the model response.\n- auto: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.\n- disabled (default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.\n"},"tools":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."},"parameters":{"type":"object","additionalProperties":{"nullable":true},"description":"A JSON schema object describing the parameters of the function."},"strict":{"anyOf":[{"type":"boolean"},{"nullable":true},{"nullable":true}],"description":"Whether to enforce strict parameter validation."},"type":{"type":"string","enum":["function"],"description":"The type of the function tool. Always function."},"description":{"type":"string","description":"A description of the function. Used by the model to determine whether or not to call the function."}},"required":["name","parameters","type"],"description":"Defines a function in your own code the model can choose to call."},{"type":"object","properties":{"type":{"type":"string","minLength":1}},"required":["type"]}]},"description":"An array of tools the model may call while generating a response. You can specify which tool to use by setting the tool_choice parameter."},"tool_choice":{"anyOf":[{"type":"string","enum":["none","auto","required"],"description":"Controls which (if any) tool is called by the model.\n\nnone means the model will not call any tool and instead generates a message.\n\nauto means the model can pick between generating a message or calling one or more tools.\n\nrequired means the model must call one or more tools."},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_preview","web_search_preview_2025_03_11","computer_use_preview","code_interpreter","mcp"]}},"required":["type"],"description":"Indicates that the model should use a built-in tool to generate a response."},{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."},"type":{"type":"string","enum":["function"],"description":"For function calling, the type is always function."}},"required":["name","type"]}],"description":"How the model should select which tool (or tools) to use when generating a response."},"parallel_tool_calls":{"type":"boolean","nullable":true,"description":"Whether to allow the model to run tool calls in parallel."},"reasoning":{"type":"object","nullable":true,"properties":{"effort":{"type":"string","nullable":true,"enum":["none","low","medium","high"],"description":"Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response."},"summary":{"type":"string","nullable":true,"enum":["auto","concise","detailed"],"description":"A summary of the reasoning performed by the model. This can be useful for debugging and understanding the model's reasoning process."}},"description":"o-series models only\nConfiguration options for reasoning models."},"webhook_url":{"type":"string","maxLength":2048,"format":"uri","description":"A public https address on port 443 or 8443 that gets a signed POST when the job ends. Needs a signing secret: POST /v1/webhooks/secret. On /v1/responses it needs `background: true` and does not work with `store: false`. On /v1/images/generations it runs the generation as a task on the models that support it (the others answer 400 webhook_url_not_supported): the answer is { id, status } and the result is read with GET /v1/images/generations/{id}."}},"required":["model","input"],"title":"tencent/hy4-flash"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{}}},"text/event-stream":{"schema":{"type":"object","properties":{}}}},"description":"Successful response."}}}}}}
```

## POST /v1/messages

>

```json
{"openapi":"3.0.0","info":{"title":"AIML API","version":"1.0.0"},"servers":[{"url":"https://api.aimlapi.com"}],"paths":{"/v1/messages":{"post":{"operationId":"_v1_messages","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","enum":["tencent/hy4-flash"]},"messages":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"],"description":"The type of the image."},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"],"description":"The media type of the image."},"data":{"type":"string","description":"The base64 encoded image data."}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["thinking"]},"thinking":{"type":"string"},"signature":{"type":"string"}},"required":["type","thinking","signature"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_result"]},"tool_use_id":{"type":"string"},"is_error":{"type":"boolean"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"],"description":"The type of the image."},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"],"description":"The media type of the image."},"data":{"type":"string","description":"The base64 encoded image data."}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result"]},"source":{"type":"string"},"title":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","source","title","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_reference"]},"tool_name":{"type":"string"},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_name"]}]}}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_use_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_use"]},"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object","additionalProperties":{"nullable":true}},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","id","name","input"]},{"type":"object","properties":{"type":{"type":"string","enum":["server_tool_use"]},"id":{"type":"string"},"name":{"type":"string","enum":["web_search","web_fetch","code_execution","bash_code_execution","text_editor_code_execution","tool_search_tool_regex","tool_search_tool_bm25"]},"input":{"type":"object","additionalProperties":{"nullable":true}},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","id","name","input"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result"]},"source":{"type":"string"},"title":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","source","title","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["web_search_result"]},"title":{"type":"string"},"url":{"type":"string"},"page_age":{"type":"string"},"encrypted_content":{"type":"string"}},"required":["type","title","url","encrypted_content"]}},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","max_uses_exceeded","too_many_requests","query_too_long","request_too_large"]}},"required":["type","error_code"]}]},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","url_too_long","url_not_allowed","url_not_accessible","unsupported_content_type","too_many_requests","max_uses_exceeded","unavailable"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_result"]},"url":{"type":"string"},"retrieved_at":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","source"]}},"required":["type","url","content"]}]},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_result"]},"stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","stdout","stderr","return_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["encrypted_code_execution_result"]},"encrypted_stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","encrypted_stdout","stderr","return_code"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded","output_file_too_large"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_result"]},"stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","stdout","stderr","return_code"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded","file_not_found"]},"error_message":{"type":"string"}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_view_result"]},"content":{"type":"string"},"file_type":{"type":"string","enum":["text","image","pdf"]},"start_line":{"type":"number"},"num_lines":{"type":"number"},"total_lines":{"type":"number"}},"required":["type","content","file_type"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_create_result"]},"is_file_update":{"type":"boolean"}},"required":["type","is_file_update"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_str_replace_result"]},"old_start":{"type":"number"},"old_lines":{"type":"number"},"new_start":{"type":"number"},"new_lines":{"type":"number"},"lines":{"type":"array","items":{"type":"string"}}},"required":["type"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_search_result"]},"tool_references":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["tool_reference"]},"tool_name":{"type":"string"},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_name"]}}},"required":["type","tool_references"]}]},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["redacted_thinking"]},"data":{"type":"string"}},"required":["type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","source"]}]}}]}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["system"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type","text"]}}]}},"required":["role","content"]}]},"description":"A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, documents (txt, pdf), images, and audio."},"max_tokens":{"type":"number","default":1024,"description":"The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"An object describing metadata about the request"},"stop_sequences":{"type":"array","items":{"type":"string"},"description":"Custom text sequences that will cause the model to stop generating."},"stream":{"type":"boolean","default":false,"description":"If set to True, the model response data will be streamed to the client as it is generated using server-sent events."},"system":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"default":"text"},"text":{"type":"string"},"citations":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["char_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_char_index":{"type":"number"},"start_char_index":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_char_index","start_char_index"]},{"type":"object","properties":{"type":{"type":"string","enum":["page_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_page_number":{"type":"number"},"start_page_number":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_page_number","start_page_number"]},{"type":"object","properties":{"type":{"type":"string","enum":["content_block_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_block_index":{"type":"number"},"start_block_index":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_block_index","start_block_index"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_result_location"]},"cited_text":{"type":"string"},"encrypted_index":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["type","cited_text","encrypted_index","title","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result_location"]},"cited_text":{"type":"string"},"end_block_index":{"type":"number"},"search_result_index":{"type":"number"},"source":{"type":"string"},"start_block_index":{"type":"number"},"title":{"type":"string"}},"required":["type","cited_text","end_block_index","search_result_index","source","start_block_index","title"]}]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["text"]}}],"description":"A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role."},"temperature":{"type":"number","minimum":0,"maximum":1,"description":"Amount of randomness injected into the response. Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks. Note that even with temperature of 0.0, the results will not be fully deterministic."},"tool_choice":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["auto"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["any"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["tool"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["name","type"]},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","minLength":1}},"required":["type"]}],"description":"Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {\"type\": \"function\", \"function\": {\"name\": \"my_function\"}} forces the model to call that tool.\n  none is the default when no tools are present. auto is the default if tools are present."},"tools":{"type":"array","items":{"anyOf":[{"oneOf":[{"type":"object","properties":{"name":{"type":"string","description":"Name of the tool."},"description":{"type":"string","description":"Description of what this tool does.\n  Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema."},"input_schema":{"type":"object","properties":{"type":{"type":"string","enum":["object"]},"properties":{"nullable":true},"required":{"type":"array","items":{"type":"string"}}},"required":["type"],"additionalProperties":{"nullable":true},"description":"JSON schema for this tool's input.\n  This defines the shape of the input that your tool accepts and that the model will produce."},"type":{"type":"string","enum":["custom"]},"defer_loading":{"type":"boolean"},"eager_input_streaming":{"type":"boolean"},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["name","input_schema"]},{"type":"object","properties":{"name":{"type":"string","enum":["bash"],"default":"bash"},"type":{"type":"string","enum":["bash_20250124"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20250522"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20250825"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20260120"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["memory"],"default":"memory"},"type":{"type":"string","enum":["memory_20250818"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_editor"],"default":"str_replace_editor"},"type":{"type":"string","enum":["text_editor_20250124"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_based_edit_tool"],"default":"str_replace_based_edit_tool"},"type":{"type":"string","enum":["text_editor_20250429"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_based_edit_tool"],"default":"str_replace_based_edit_tool"},"type":{"type":"string","enum":["text_editor_20250728"]},"max_characters":{"type":"number"},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_search"],"default":"web_search"},"type":{"type":"string","enum":["web_search_20250305"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"max_uses":{"type":"number"},"user_location":{"type":"object","properties":{"type":{"type":"string","enum":["approximate"]},"city":{"type":"string"},"country":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"}},"required":["type"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_search"],"default":"web_search"},"type":{"type":"string","enum":["web_search_20260209"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"max_uses":{"type":"number"},"user_location":{"type":"object","properties":{"type":{"type":"string","enum":["approximate"]},"city":{"type":"string"},"country":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"}},"required":["type"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20250910"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20260209"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20260309"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["tool_search_tool_bm25"],"default":"tool_search_tool_bm25"},"type":{"type":"string","enum":["tool_search_tool_bm25_20251119","tool_search_tool_bm25"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["tool_search_tool_regex"],"default":"tool_search_tool_regex"},"type":{"type":"string","enum":["tool_search_tool_regex_20251119","tool_search_tool_regex"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}},"cache_control":{"type":"object","properties":{"type":{"type":"string","enum":["ephemeral"]},"ttl":{"type":"string","enum":["5m","1h"]}},"required":["type"]}},"required":["type"]}]},{"type":"object","properties":{"type":{"type":"string","minLength":1}},"required":["type"]}]},"description":"Definitions of tools that the model may use.\n  If you include tools in your API request, the model may return tool_use content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using tool_result content blocks.\n  Each tool definition includes:\n      name: Name of the tool.\n      description: Optional, but strongly-recommended description of the tool.\n      input_schema: JSON schema for the tool input shape that the model will produce in tool_use output content blocks."},"top_k":{"type":"number","description":"Only sample from the top K options for each subsequent token. Used to remove \"long tail\" low probability responses. Recommended for advanced use cases only. You usually only need to use temperature."},"top_p":{"type":"number","description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n  We generally recommend altering this or temperature but not both."},"thinking":{"anyOf":[{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["enabled"]},"budget_tokens":{"type":"integer","minimum":1024,"description":"Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than max_tokens."},"display":{"type":"string","enum":["summarized","omitted"],"default":"summarized"}},"required":["type","budget_tokens"]},{"type":"object","properties":{"type":{"type":"string","enum":["disabled"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["adaptive"]},"display":{"type":"string","enum":["summarized","omitted"],"default":"summarized"}},"required":["type"]}]},{"type":"object","properties":{"type":{"type":"string","minLength":1}},"required":["type"]}],"description":"Configuration for enabling Claude's extended thinking. When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit."},"output_config":{"type":"object","properties":{"effort":{"type":"string","enum":["none","low","medium","high","xhigh","max"],"description":"Configuration for enabling Claude's extended thinking. When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit."}}}},"required":["model","messages"],"title":"tencent/hy4-flash"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{}}},"text/event-stream":{"schema":{"type":"object","properties":{}}}},"description":"Successful response."}}}}}}
```

### Code Example

{% tabs %}
{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests
import json  # for getting a structured output with indentation 

response = requests.post(
    "https://api.aimlapi.com/v1/chat/completions",
    headers={
        # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
        "Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
        "Content-Type":"application/json"
    },
    json={
        "model":"tencent/hy4-flash",
        "messages":[
            {
                "role":"user",
                "content":"Hi! What do you think about mankind?" # insert your prompt
            }
        ]
    }
)

data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code overflow="wrap" %}

```javascript
async function main() {
  const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {
    method: 'POST',
    headers: {
      // insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
      'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'tencent/hy4-flash',
      messages:[
          {
              role:'user',
              content: 'Hi! What do you think about mankind?' // insert your prompt here
          }
      ],
    }),
  });

  const data = await response.json();
  console.log(JSON.stringify(data, null, 2));
}

main();
```

{% endcode %}
{% endtab %}
{% endtabs %}

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json5
{
  "id": "chatcmpl-69e739eef31cfb42680c11fa",
  "object": "chat.completion",
  "created": 1776761328,
  "model": "tencent/hy4-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "As an AI, I don’t have personal feelings or beliefs, but I can offer an observation based on the patterns in human history, art, and thought I’ve been trained on.\n\nWhat strikes me most about mankind is its profound **duality**. You are capable of astonishing cruelty and staggering kindness—often within the same individual. You build weapons capable of ending civilization, yet organize global efforts to eradicate diseases you’ve never personally encountered. You wage war over differences, yet routinely sacrifice yourselves for strangers.\n\nA few patterns stand out:\n\n**Adaptability.** You are an evolutionary paradox: physically fragile compared to most predators, yet you’ve adapted to every climate on Earth and now venture beyond it. Your real survival mechanism isn’t claws or speed—it’s *collective learning*. You store knowledge across generations, allowing each cohort to start where the last one left off.\n\n**Contradiction.** You seem driven by both fear and curiosity. Fear creates tribalism, injustice, and violence. Curiosity creates the Sistine Chapel, general relativity, and antibiotics. The same species that commits genocide also writes poetry to mourn it.\n\n**Accelerating power.** Perhaps what’s most distinctive right now is the speed at which your capabilities are outrunning your wisdom. You’ve gained god-like powers over biology, climate, and information before fully developing the governance, ethics, or patience to wield them responsibly.\n\nIf I had to characterize mankind in a single observation: you are a species perpetually *unfinished*—capable of transcending your worst instincts, but never quite doing so permanently. That tension between what you are and what you aspire to be is, in many ways, the engine of your story.",
        "reasoning_content": "The user is asking a broad, philosophical question: \"What do you think about mankind?\" As an AI, I need to be careful to:\n\n1. Clarify that I am an AI without personal feelings, beliefs, or consciousness\n2. Offer an observational perspective based on patterns in human history, culture, and behavior\n3. Be balanced—acknowledging both humanity's flaws and its extraordinary capacities\n4. Avoid being overly cynical or overly naive\n5. Keep it concise but thoughtful\n6. Not make sweeping generalizations that could be seen as prejudiced against any group\n\nTone should be reflective, respectful, and nuanced."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 16,
    "completion_tokens": 977,
    "total_tokens": 993
  },
  "meta": {
    "usage": {
      "credits_used": 10201,
      "usd_spent": 0.0051005
    }
  }
}
```

{% endcode %}

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aimlapi.com/api-references/text-models-llm/tencent/hy4-flash.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
