---
title: "模型广场聊天代理"
method: POST
path: "/v1/playground/chat/completions"
tags: ["PlaygroundService"]
---

# 模型广场聊天代理

`POST /v1/playground/chat/completions`

用户登录态 JWT 鉴权，前端只提交 apiKeyId 和 OpenAI Chat Completions 兼容请求体； 后端按 apiKeyId 还原用户 API Key 上下文并调用网关，不向前端暴露 API Key 明文。

## Request body

- object
  - `apiKeyId` union, required — 当前登录用户名下已启用 API Key 的 ID。
    - string
    - integer
  - `frequency_penalty` number
  - `max_tokens` integer
  - `messages` object[], required — OpenAI Chat messages。
    - `content` union, required
      - string
      - object[]
    - `role` 'system' | 'user' | 'assistant' | 'tool', required
  - `model` string, required — 模型名称。
  - `presence_penalty` number
  - `stream` boolean
  - `temperature` number
  - `top_p` number

## Response `200`

OK，非流式返回 JSON；流式返回 text/event-stream。

## Other responses

- `400` — 请求体非法或缺少 apiKeyId。
- `401` — 未登录或 API Key 无效。
- `403` — API Key 不属于当前用户或缺少 chat scope。

---

[API](https://skmtc.dev/apiqik/apis/apiqik-api.md) · [All operations](https://skmtc.dev/apiqik/apis/apiqik-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/apiqik/apiqik-api/revisions/e06b96127408/schema)
