curl -X POST https://your-domain/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.1-8B",
"messages": [{"role": "user", "content": "你好"}],
"stream": false
}'
import requests
resp = requests.post(
"https://your-domain/v1/chat/completions",
json={
"model": "llama3.1-8B",
"messages": [{"role": "user", "content": "你好"}],
"stream": False
}
)
print(resp.json()["choices"][0]["message"]["content"])
const resp = await fetch("https://your-domain/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "llama3.1-8B",
messages: [{ role: "user", content: "你好" }],
stream: false
})
});
const data = await resp.json();
console.log(data.choices[0].message.content);