go-cerebras
БесплатноБез исполняемых скриптовНе проверенWrites Go code with go-cerebras (package cerebras, github.com/psyb0t/go-cerebras), an unofficial client for the Cerebras Inference API generated with…
от psyb0t511 установок в других каталогахОб этом скилле
go-cerebras
Typed Go client for the Cerebras Inference API. Every operation in the spec is a method on ClientWithResponses, named after its operation ID.
For install, the method list, unions and error handling in detail, see references/setup.md.
Security & safety
- Read the API key from an environment variable such as
CEREBRAS_API_KEY. Never hardcode it, commit it or log it, and never print request headers. - Requests go only to the base URL passed to
NewClientWithResponses. Prompts sent through the client reach Cerebras.
When to use
- Go code calls Cerebras for chat or text completions, or lists the models it serves.
- The project already imports
github.com/psyb0t/go-cerebras.
When NOT to use
- You need streaming. The generated client returns the whole body; for
stream: truecall the plainClientmethod and read the body of the*http.Responseit returns yourself. - The code is not Go. Use Cerebras's own SDKs.
Finding endpoints and types
The examples below cover a few calls. Every operation in the spec has a generated method, and the spec's descriptions are on them as Go doc comments. Look names and fields up instead of guessing. After go get github.com/psyb0t/go-cerebras, from inside your module:
go doc github.com/psyb0t/go-cerebras ClientWithResponsesInterface # every endpoint method
go doc github.com/psyb0t/go-cerebras ChatCompletionRequest # one method, params type or model
go doc -all github.com/psyb0t/go-cerebras # the whole package
The same documentation is at https://pkg.go.dev/github.com/psyb0t/go-cerebras.
Method names come from the spec's operation IDs, which include the path and HTTP method (ChatV1ChatCompletionsPost). <OperationId>WithResponse takes the context, then the path parameters in order, then *<OperationId>Params when the operation has query or header parameters, then the request body when it has one. The JSON200 field (or JSON422 and so on, per declared status) holds the decoded body; it is nil for any other status. Chat and model list bodies are unions, decoded with their As... methods.
Usage
import (
"context"
"fmt"
"net/http"
"os"
"github.com/psyb0t/go-cerebras"
)
auth := cerebras.WithRequestEditorFn(func(_ context.Context, req *http.Request) error {
req.Header.Set("Authorization", "Bearer "+os.Getenv("CEREBRAS_API_KEY"))
return nil
})
client, err := cerebras.NewClientWithResponses("https://api.cerebras.ai", auth)
if err != nil {
return err
}
var content cerebras.UserMessageRequest_Content
if err := content.FromUserMessageRequestContent0("Say hi"); err != nil {
return err
}
role := cerebras.UserMessageRequestRoleUser
var msg cerebras.ChatCompletionRequest_Messages_Item
if err := msg.FromUserMessageRequest(cerebras.UserMessageRequest{Content: content, Role: &role}); err != nil {
return err
}
res, err := client.ChatV1ChatCompletionsPostWithResponse(ctx,
&cerebras.ChatV1ChatCompletionsPostParams{},
cerebras.ChatCompletionRequest{Model: "<model-id>", Messages: []cerebras.ChatCompletionRequest_Messages_Item{msg}},
)
if err != nil {
return err // transport error
}
if res.JSON200 == nil {
return fmt.Errorf("chat: status %d: %s", res.StatusCode(), res.Body)
}
completion, err := res.JSON200.AsChatCompletionResponse()
if err != nil {
return err
}
fmt.Println(*completion.Choices[0].Message.Content)
Listing models:
res, err := client.ListModelsV1ModelsGetWithResponse(ctx, &cerebras.ListModelsV1ModelsGetParams{})
if err != nil {
return err
}
list, err := res.JSON200.AsModelMetadataList()
Check JSON200 for nil before reading it. A non-2xx status is not a Go error; the status is in StatusCode() and the raw body in Body.
Установить go-cerebras в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл go-cerebras?
Writes Go code with go-cerebras (package cerebras, github.com/psyb0t/go-cerebras), an unofficial client for the Cerebras Inference API generated with oapi-codegen. `cerebras.NewClientWithResponses("https://api.cerebras.ai", cerebras.WithRequestEditorFn(...))` gives typed methods for every path of the spec, including chat completions (`ChatV1ChatCompletionsPost`), text completions (`CompletionsV1CompletionsPost`), model listing and lookup, and TCP warming. Union schemas come with `As...`/`From...` helpers. Use when Go code needs to call Cerebras inference, or already imports go-cerebras.
Как установить скилл go-cerebras?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл go-cerebras запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic