xAI (Grok) Provider —— OpenAI 兼容实现(统一由 base/defprovider 生成)。
端点:https://api.x.ai/v1/chat/completions(Bearer 鉴权) 需要 XAI_API_KEY 或显式 :api-key。 模型:grok-4.5、grok-4.3、grok-4.20-reasoning、grok-4.20-non-reasoning、grok-latest 等。
继承 common.openai-compat 的全部通用能力(工具调用 / 流式 / 结构化输出 / :reasoning-effort / :extra-body 逃生通道);grok 的推理内容经 message.reasoning_content 返回,已由统一响应层归一化到 :reasoning。
(require '[im.ttalk.agent.provider.xai :as xai]) (def provider (xai/create-provider {:api-key "xai-..."}))
xAI (Grok) Provider —— OpenAI 兼容实现(统一由 base/defprovider 生成)。
端点:https://api.x.ai/v1/chat/completions(Bearer 鉴权)
需要 XAI_API_KEY 或显式 :api-key。
模型:grok-4.5、grok-4.3、grok-4.20-reasoning、grok-4.20-non-reasoning、grok-latest 等。
继承 common.openai-compat 的全部通用能力(工具调用 / 流式 / 结构化输出 /
:reasoning-effort / :extra-body 逃生通道);grok 的推理内容经
message.reasoning_content 返回,已由统一响应层归一化到 :reasoning。
(require '[im.ttalk.agent.provider.xai :as xai])
(def provider (xai/create-provider {:api-key "xai-..."}))(call-xai config__10075__auto__ messages__10076__auto__ tools__10077__auto__)调用 xai API(同步)
调用 xai API(同步)
(call-xai-async config__10075__auto__
messages__10076__auto__
tools__10077__auto__)异步调用 xai API(返回 deferred<响应体>)
异步调用 xai API(返回 deferred<响应体>)
(call-xai-stream config__10075__auto__
messages__10076__auto__
tools__10077__auto__
on-token__10078__auto__)流式调用 xai API
流式调用 xai API
(call-xai-stream-async config__10075__auto__
messages__10076__auto__
tools__10077__auto__
on-token__10078__auto__)异步流式调用 xai API(返回 deferred<最终响应>)
异步流式调用 xai API(返回 deferred<最终响应>)
(create-provider)(create-provider opts10696)创建 xai Provider
创建 xai Provider
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |