Clients
Go LLM Proxy client with a v2-only transport
Use the Go package to send canonical messages requests through POST /v2.
Go developers integrating application backends with LLM Proxy.
The problem
Reusable clients can expose too many legacy request shapes and force callers to choose between prompt JSON and chat messages.
How LLM Proxy helps
The Go package under pkg/llmproxyclient exposes the canonical MessagesRequest and Client.PostMessages path for text requests.
How it works
- Import github.com/tyemirov/llm-proxy/pkg/llmproxyclient.
- Build a MessagesRequest with NewMessagesRequest.
- Configure base URL and tenant secret.
- Let omitted model stay omitted when provider defaults should apply.
- Set MessagesRequestInput.ReasoningEffort only for a nonblank value the resolved route declares.
- Set MessagesRequestInput.RequestTimeoutSeconds only when this request needs a specific proxy work budget.
Feature-to-benefit table
| Feature | Why it matters here | Example |
|---|---|---|
| v2-only API | The reusable package exposes messages requests rather than multiple text shapes. | Callers standardize on POST /v2. |
| Provider query preservation | Base URLs can include non-payload query parameters such as provider. | Provider-selected requests still use the canonical body. |
| Omitted-model behavior | The client omits model unless the caller specifies it. | Server-side defaults remain authoritative. |
| Reasoning-effort override | MessagesRequestInput serializes an optional nonblank ReasoningEffort value. | The proxy, not the client, validates exact model capability. |
| Per-request work budget | RequestTimeoutSeconds serializes the canonical timeout header. | Go context cancellation remains separate and caller-owned. |
Use-case examples
Backend service
A Go service sends system and user messages through Client.PostMessages.
Provider-specific base URL
The base URL includes ?provider=gemini while the request body omits model.
Max-token override
A caller adds max_tokens for one request without changing provider defaults.
Long review
A caller requests a larger bounded proxy work budget without changing the HTTP client's total timeout.
Objections and limitations
- The Go client is for text messages, not /dictate multipart uploads.
- It does not implement OpenAI background polling because the server owns that lifecycle.
- Direct REST callers can still use server GET and compatibility POST endpoints outside the client package.
Repository evidence
config, err := llmproxyclient.NewConfig(llmproxyclient.ConfigInput{
BaseURL: "http://localhost:8080/",
Secret: serviceSecret,
ModelProfilePath: userModelProfilePath,
ModelProfileReader: os.ReadFile,
})
if err != nil {
return err
}
client, err := llmproxyclient.NewClient(config, http.DefaultClient)
if err != nil {
return err
}
requestTimeoutSeconds := 900
request, err := llmproxyclient.NewMessagesRequest(llmproxyclient.MessagesRequestInput{
Messages: []llmproxyclient.MessageInput{
{Role: "user", Content: "Summarize this"},
},
RequestTimeoutSeconds: &requestTimeoutSeconds,
})
Verified 2026-08-08 by Tyemirov on GitHub against README.md.
FAQ
What is the main job of Go LLM proxy client v2?
The Go package under pkg/llmproxyclient exposes the canonical MessagesRequest and Client.PostMessages path for text requests.
Who should read this clients resource?
Go developers integrating application backends with LLM Proxy.
Does this page claim provider performance or pricing advantages?
No. The supported claim is about LLM Proxy's documented routing, configuration, management, security, usage, and deployment contracts. Provider cost, speed, rankings, and benchmark claims are not made here.
Where should setup details come from?
Use the main README and implementation notes for current command, config, and endpoint details. This page summarizes the workflow without replacing LLM Proxy documentation.
What should I read next?
A closely related resource is Authenticate an LLM Proxy client with a tenant secret, which covers LLM Proxy client authentication.
Related resources
Use this pattern in LLM Proxy
Start from the canonical API reference, then use the management surface when the workflow needs tenant or provider configuration.
Open API reference