Как подключить CheapLLM к Go
Официальный Go SDK от OpenAI. Пошаговая настройка CheapLLM API в Go с доступом к Claude, GPT-6, Gemini и DeepSeek до 70% дешевле.
1. Создайте API-ключ CheapLLM
Создайте аккаунт CheapLLM и выпустите API-ключ (sk-clm-YOUR_API_KEY) — один ключ открывает доступ ко всем 49+ моделям OpenAI, Anthropic, Google и DeepSeek до 70% дешевле официальных прайсов.
Base URL (OpenAI-совместимый)
https://api.cheapllm.app/v12. Установите openai-go
Терминал
go get github.com/openai/openai-go3. Отправьте первый запрос
main.go
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithBaseURL("https://api.cheapllm.app/v1"),
option.WithAPIKey("sk-clm-YOUR_API_KEY"),
)
res, _ := client.Chat.Completions.New(context.Background(), openai.ChatCompletionNewParams{
Model: "gpt-6.2-sol",
Messages: []openai.ChatCompletionMessageParamUnion{
openai.UserMessage("Привет!"),
},
})
fmt.Println(res.Choices[0].Message.Content)
}Лучшие модели для Go
Все 49+ моделей →| Модель | Официально (вх / вых) | CheapLLM (вх / вых) | Экономия |
|---|---|---|---|
| Claude Opus 5.5 | $2.80 / $14.00 | −30% | |
| GPT-6.1 Sol | $1.40 / $7.00 | −30% | |
| Gemini 4 Argon | $1.40 / $7.00 | −30% | |
| DeepSeek V4 Pro 0813 | $0.078 / $3.11 | −30% |