Chat Completions
POST https://api.moyuncourse.site/v1/chat/completions
The OpenAI-compatible chat completion endpoint — the core way to call Nodaryx.
Request fields
| Field | Type | Description |
|---|---|---|
| model | string | Model ID, e.g. gemini-flash, deepseek-v4-flash (see Models overview) |
| messages | array | Conversation messages, each with role (system/user/assistant) and content |
| temperature | number | Sampling temperature; higher is more random (optional) |
| max_tokens | number | Max tokens to generate (optional; the model default is used if omitted) |
| stream | boolean | Stream the response — see Streaming |
Response fields
| Field | Description |
|---|---|
| id | Unique ID for this completion |
| model | The model actually used |
| choices | Candidate replies; the text is in choices[0].message.content |
| usage | Token usage: prompt_tokens / completion_tokens / total_tokens |
Node.js example
const res = await fetch("https://api.moyuncourse.site/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NODARYX_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gemini-flash",
messages: [
{ role: "system", content: "You are a concise assistant." },
{ role: "user", content: "Hello" },
],
}),
});
const data = await res.json();
console.log(data.choices[0].message.content);
Python example
from openai import OpenAI
client = OpenAI(
base_url="https://api.moyuncourse.site/v1",
api_key="sk-nodaryx-xxxxxxxxxxxxxxxx",
)
resp = client.chat.completions.create(
model="gemini-flash",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)