第一次调用
LLM API 的基地址为 https://api.inflox.ai。下面以 Chat Completions 接口为例发起首次调用。
文中模型名以 {provider}/{model} 占位表示。可用模型可通过无需鉴权的 GET https://api.inflox.ai/v1/models 实时获取;含定价的完整清单见 模型清单。
非流式请求
curl https://api.inflox.ai/v1/chat/completions \
-H "Authorization: Bearer wk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "{provider}/{model}",
"messages": [{"role": "user", "content": "你好"}]
}'响应:
{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1788169683,
"model": "{provider}/{model}",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "你好!" },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 30
}
}流式请求(SSE)
加 "stream": true,响应以 data: {...} 逐块返回,以 data: [DONE] 结束。
curl -N https://api.inflox.ai/v1/chat/completions \
-H "Authorization: Bearer wk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "{provider}/{model}",
"messages": [{"role": "user", "content": "介绍一下你自己"}],
"stream": true
}'下一步
- 了解请求/响应字段:Chat Completions
- 查看可用模型:模型列表