LLM integration

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

model and messages are required. Every parameter, with its accepted values, is in the API Reference.

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" }
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'
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" }],
});