Skip to content

Pet Image Recognition ​

Pet Image Recognition uses module_type = 5. Select exactly one capability with sub_module_type, whose valid values are 1 through 8. A session is bound to one capability and one input image. Create a new session to inspect a different body part or use a different image.

Gateway capability prefixhttps://open-api.habitaxx.com/v1/ms-ai-fast

Recommended integration

The shortest report workflow is: create the recognition session, upload the image, stream the recognition and summary, submit the report task, then poll and retrieve the report. See the full workflow for SSE handling, language behavior, and session constraints.

Capability matrix ​

sub_module_typeCapability
1Breed recognition
2Expression recognition
3Dental detection
4Feces detection
5Vomit detection
6Skin detection
7Ear-canal detection
8Eye detection

sub_module_type is an API parameter, not display text. It must stay consistent with session creation: a skin session always sends 6 and must not switch to 8 under the same session_id.

Upload the image
Call POST /oss/images; read url from the top-level data object in the complete success JSON, then send that exact string as the later img_url value.
Get the first result
Call an immediate recognition endpoint. If session_id is omitted, the service creates a pic_... session.
Optionally create a summary
Use a JSON or SSE summary for an existing session when the product needs a saved session summary.
Generate and retrieve the report
Submit the report task, poll it to completion, then retrieve the complete medical record.

Image URL handoff ​

Image Recognition and Smart Consultation share POST /oss/images. Here, url means the field in the upload response JSON; it is not a field returned by an image-recognition endpoint. Image-recognition request bodies use the field img_url, whose value must be copied unchanged from the upload response's url.

StepEndpoint or fieldRequirement
1POST /oss/imagesUpload with multipart/form-data; the form field name is file.
2Top-level url in the upload responseRead and persist the platform-registered image URL.
3img_url in POST /ai-pic/summary/streamSend the exact same URL from step 2 without rewriting it.
4img_url in other image-recognition requestsReuse the same URL for POST /ai-pic/sessions/report-tasks.

Complete upload success response:

json
{
  "code": 200,
  "message": "success",
  "data": {
    "media_type": "image",
    "file_name": "server-generated-name.jpg",
    "object_key": "test/ai-pic/server-generated-name.jpg",
    "content_type": "image/jpeg",
    "size_bytes": 245810,
    "etag": "<ETAG>",
    "url": "<UPLOAD_RESPONSE_DATA_URL>"
  }
}

Corresponding image-recognition request body:

json
{
  "pet_profile_id": 44,
  "img_url": "<UPLOAD_RESPONSE_DATA_URL>",
  "sub_module_type": 6,
  "lang": "en-US"
}

Do not replace url with an image webpage URL, a hand-built OSS URL, a third-party URL, a URL with a query string or fragment, or an asset uploaded by another user.

Choose an endpoint ​

This table explains which endpoint to call and what to do after success. Use the complete examples in the API overview and the individual endpoint pages to locate fields; isolated field paths no longer stand in for complete responses.

Use caseEndpointResponse typeWhat to do after success
Create the recognition sessionPOST /session-records/sessionsRegular JSONSend module_type fixed to 5, plus sub_module_type (1-8) and a numeric pet_profile_id; read session_id from the data object of the complete response.
Upload the imagePOST /oss/imagesRegular JSONRead url from the top-level data object of the complete response and use it unchanged as img_url later.
Run recognition and generate the summaryPOST /ai-pic/summary/streamSSE streamRender events whose type is content progressively. Recognition succeeds only after the complete terminal event whose type is done; the final result is inside that done event.
Generate a complete reportPOST /ai-pic/sessions/report-tasksRegular JSON containing a background taskRead task_id from the task object in the complete success response. Then call GET /ai-tasks/{task_id} until the task status becomes succeeded, failed, or canceled. This call may be published in parallel with the recognition stream.
Read the reportGET /medical-records/{record_id}Regular JSONAfter the report task succeeds, read the record details and report fragments; list past recognition records with GET /medical-records?module_type=5.

Only complete-report generation creates a background task that must be polled; its task type is ai_pic_report_generate. Recognition itself is performed by summary/stream, so there is no recognition task to poll.

Image and session prerequisites ​

  • Image uploads support jpg, jpeg, png, webp, and gif, up to 10 MiB. See Common APIs.
  • pet_profile_id is the numeric ID obtained from the Pet Profiles endpoints (for example 44); it must match the session.
  • Image-recognition language is the request body field lang, defaulting to zh-CN. It is not the same as a profile API query parameter such as ?locale=.... When a session exists, omit lang or send the exact same value used to create that session.
  • In the successful JSON response from POST /oss/images, read the url field inside the top-level data object. Send that exact string as img_url; third-party URLs, hand-built OSS URLs, URLs with a query string, and another user's asset are rejected. Typical errors include MEDIA_URL_NOT_ALLOWED, MEDIA_ASSET_NOT_FOUND, and MEDIA_URL_INVALID.
  • The first image asset used by a session is bound to that session. Replacing it in a later summary or report request returns TASK_IDEMPOTENCY_CONFLICT; create a new session instead.

Logging and compliance ​

  • After each upload, record the response url together with session_id and sub_module_type as the minimum audit trail.
  • Images and recognition results contain pet and user data; handle them according to your own data-authorisation and retention rules.
  • Recognition results support health screening only and are not a veterinary diagnosis, prescription, or emergency advice.
最近更新

Qijie Open Platform · API Documentation