跳转到内容
搜索文档

Cerebras

最后更新 查看 MarkdownAgent 设置

Cerebras 为开发者提供低延迟的 AI 模型推理解决方案。

端点

https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cerebras

前提条件

向 Cerebras 发送请求时,请确保具备以下条件:

  • 你的 AI Gateway Account ID。
  • 你的 AI Gateway gateway 名称。
  • 有效的 Cerebras API 令牌。
  • 要使用的 Cerebras 模型名称。

示例

cURL

Example fetch requestbash
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/cerebras/chat/completions \
 --header 'content-type: application/json' \
 --header 'Authorization: Bearer CEREBRAS_TOKEN' \
 --data '{
    "model": "llama3.1-8b",
    "messages": [
        {
            "role": "user",
            "content": "What is Cloudflare?"
        }
    ]
}'

OpenAI 兼容端点

你也可以通过 REST API 使用 OpenAI API schema 访问 Cerebras 模型。将请求发送至:

https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1/chat/completions

指定:


{
"model": "cerebras/{model}"
}

这篇文档对您有帮助吗?