---
title: "基于聊天消息及历史消息和其他相关信息（角色背景、用户 profile 等）生成图片"
method: POST
path: "/api/v1/chat/images/{agent_id}"
tags: ["chat", "evaluation"]
---

# 基于聊天消息及历史消息和其他相关信息（角色背景、用户 profile 等）生成图片

`POST /api/v1/chat/images/{agent_id}`

根据Agent角色、聊天历史和用户消息生成图片，并保存到聊天历史中。注意：路径参数 `agent_id` 仅作为目前的名称，实际应为 `chat_id`。未来如需扩展可直接重命名。agent id 则代表与该 agent 的*当前*会话的 id

## Path parameters

- `agent_id` string, required

## Request body

- ChatImageGenerationRequest — 聊天生图请求 - 基于已有消息生成图片
  - `message_id` integer, required
  - `history_count` integer, nullable
  - `request_id` string, nullable
  - `model` string, nullable

## Response `200`

Successful Response

- APIResponseUnionChatImageGenerationResponseUsageLimitExceededBizError
  - `code` integer
  - `message` string
  - `data` union
    - ChatImageGenerationResponse — 聊天生图响应
      - `image_url` string, required
      - `image_metadata` object, required
      - `prompt` string, required
      - `message_id` integer, required
      - `model` string, nullable
      - `generation_time_ms` integer, nullable
    - UsageLimitExceeded
      - `code` integer, required
      - `error_code` string, required
      - `message` string, required
      - `used_count` integer, required
      - `daily_limit` integer, required
    - BizError — 业务错误信息模型
      - `code` integer, required
      - `error_code` string, required
      - `message` string, required

## Other responses

- `422` — Validation Error

## Changes

- **2026-01-12** `5b77ae7cc5c4` — 3 info
  - added the new optional request property `model`
  - added the optional property `data/anyOf[subschema #1: ChatImageGenerationResponse]/generation_time_ms` to the response with the `200` status
  - added the optional property `data/anyOf[subschema #1: ChatImageGenerationResponse]/model` to the response with the `200` status
- **2025-11-25** `05cf5f034c74` — 4 info
  - api tag `evaluation` added
  - api tag `android-app` removed
  - api tag `inty-eval` removed
  - added `#/components/schemas/BizError` to the `data` response property `anyOf` list for the response status `200`
- **2025-11-02** `af02eeb49e98` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/nascentcore/apis/inty-backend/changes/api/v1/chat/images/:agent_id/post.md)

---

[API](https://skmtc.dev/nascentcore/apis/inty-backend.md) · [All operations](https://skmtc.dev/nascentcore/apis/inty-backend/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nascentcore/inty-backend/revisions/1e014c365df2/schema)
