Smart question solving API
CleverSee API
Call the solveQuestion API to submit an image of a problem and receive its solution.
Overview
API Name: solveQuestion
Capability: The API can identify multiple questions within a single image. In such cases, result_type is set to multiple.
Item | Description |
Request method | POST |
Endpoint |
|
Request format |
|
Authentication |
|
This service is billed based on the number of prompt tokens and completion tokens. The rates are CNY 18 per million prompt tokens and CNY 52 per million completion tokens, with no additional per-call fees. For detailed rules, see Vertical Search Billing.
This service requires activation. Please contact your business manager for assistance.
You can also request activation through our official support channel: Q&A and Support
API reference
Request parameters
Parameter | Type | Required | Default | Description | Example |
format | string | Yes | None | The format of the image. Valid values are |
|
imageUrl | string | Conditional | None | A publicly accessible HTTPS image URL. You must provide either this parameter or | See request example |
imageBase64 | string | Conditional | None | The standard Base64-encoded string of an image. Include trailing padding but do not include whitespace or a | Full image Base64 string |
Theformatparameter is required. You must provide eitherimageUrlorimageBase64. The specifiedformatmust match the actual file type. The image width and height cannot exceed 8,000 pixels, and the total number of pixels cannot exceed 2.6 million.
Response parameters
Parameter | Type | Returned | Description |
requestId | string | Always | The unique identifier for the request. Provide this ID when troubleshooting. |
data | object | Always | The solution results. |
data.result_type | string | Always |
|
data.finished | boolean | Always | Always returns |
data.items |
| Always | A list of the complete results for all identified questions. If the API fails to solve a question in a multi-question request, the |
data.items[].question_id | string | Always | The identifier for the question, derived from its title. If no title is available, the system generates sequential identifiers like "Question 1", "Question 2", and so on. |
data.items[].content | string | Always | The complete solution in Markdown format, including the reasoning process and the final answer. |
data.items[].status | string | Always | The status of the individual question. Valid values are |
data.items[].image_url | string | Always | The URL of the image for the current question. This URL may be time-limited. If no image resource is associated and there is no request URL to fall back to, this field is an empty string. |
data.items[].thinking | object | Optional or null | The reasoning process. This field is returned only when |
data.items[].thinking.content | string | If | The current reasoning content. |
data.items[].thinking.status | string | If | The status. Valid values are |
data.upstreamRequestId | string | Always | The request identifier echoed by the question-solving service. |
data.usage | object | Optional or null | The token usage for this request. |
data.usage.prompt_tokens | int64 | Optional | The number of prompt tokens. |
data.usage.completion_tokens | int64 | Optional | The number of completion tokens. |
data.usage.total_tokens | int64 | Optional | The total number of tokens, which is the sum of |
Examples
The image URL in the example is a placeholder. Replace it with a publicly downloadable HTTPS image URL.
Request parameters
{
"format": "png",
"imageUrl": "https://example.com/images/equation.png"
}When using a Base64-encoded image, replace imageUrl with imageBase64, provide the complete encoded string, and keep the format parameter.
Response parameters
{
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"data": {
"result_type": "multiple",
"finished": true,
"items": [
{
"question_id": "Question 1",
"content": "Question 1: Identify the problem.\nThe final result is 2.",
"status": "complete",
"image_url": "https://cdn.example.com/solve/q-1.jpg"
},
{
"question_id": "Question 2",
"content": "Question 2: Define variable x.\nSolving for x yields x=3.",
"status": "complete",
"image_url": "https://cdn.example.com/solve/q-2.jpg"
}
],
"usage": {
"prompt_tokens": 273,
"completion_tokens": 356,
"total_tokens": 629
},
"upstreamRequestId": "550e8400-e29b-41d4-a716-446655440000"
}
}This example does not include the thinking and usage objects. This does not imply that their content is empty or that the token usage is zero.
API calls
Use an API Key authorized for this API and pass it in the X-API-Key request header. The following example reads the credential from an environment variable named API_KEY. Do not hardcode your real credential in client-side code or public repositories.
curl -X POST 'https://cloud-iqs.aliyuncs.com/question/solve' \
--header "X-API-Key: $API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"format": "png",
"imageUrl": "https://example.com/images/equation.png"
}'Error codes
When an error occurs, first check the HTTP status code and the response body format before parsing the error message. A JSON response for a parameter validation failure includes requestId, errorCode, and errorMessage. For other types of errors, the response fields may vary. A response for a format error can differ from the standard structure; for example, a 415 error may have an empty response body.
Example of a parameter error:
{
"requestId": "example-request-id",
"errorCode": "InvalidParameter",
"errorMessage": "Image too large"
}Http status | Error code | Description | Solution |
400 | InvalidParameter | A required field is missing, a parameter is invalid, or the image exceeds the specified limits. | Check the |
403 | Retrieval.InvalidAPIKey | The API Key is invalid. | Check the |
403 | See response | Insufficient permissions or quota. | Verify the API activation status, calling permissions, and available quota. |
413 | RequestTooLarge | The entire HTTP request body exceeds the size limit. | Reduce the request body size or use an HTTPS image URL. |
415 | See response | The request format is not supported. | Set the |
429 | ThrottlingService (common) | The request rate is too high. | Reduce the call frequency and implement a backoff and retry strategy. |
502 | QuestionSolveFailed, UpstreamStreamInterrupted, UpstreamProtocolError, OutputLimitExceeded, etc. | Failed to solve the question, an interruption occurred in the result stream, the response format is invalid, or the output exceeded the limit. | Verify that the image is downloadable and check its content. If the issue persists, contact technical support. |
503 | ServiceUnavailable | The service is temporarily unavailable. | Try again later. If the issue persists, contact technical support. |
504 | RequestTimeout | The request timed out. | Try again later. If the issue persists, contact technical support with the request ID. |