# OpenAI-compatible chat

> Part of the ChinaAPI documentation. HTML: https://dash.chinaapi.ai/docs/api/chat/

Most OpenAI clients work after changing `baseURL`. Use the model name published in your ChinaAPI dashboard.

**Key parameters:** `model` and `messages` are required. Use `temperature`, `top_p`, `max_tokens`, and `stream` for generation behavior. `reasoning_effort` can be `low`, `medium`, `high`, or a model-specific value when the selected reasoning model supports it.

**curl**

```
curl https://api.chinaapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $CHINAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      { "role": "user", "content": "Hello" }
    ]
  }'
```

**Node.js**

```
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.CHINAAPI_KEY,
  baseURL: "https://api.chinaapi.ai/v1",
});

const result = await client.chat.completions.create({
  model: "deepseek-chat",
  messages: [{ role: "user", content: "Hello" }],
});
```
