Go AI API client (India)
Call GPT, Claude, DeepSeek and Qwen from Go with one rupee-billed API using plain net/http, one Indian GST invoice.
Go does not need a vendor SDK to call an OpenAI-compatible endpoint; the standard library's net/http and encoding/json are enough. Point that at unoblox and a Go service can call GPT, Claude, DeepSeek, Qwen, or any other catalog model with one base URL and one key, billed in rupees on a single monthly GST invoice.
Why Go services do not need a special client library
Because unoblox implements the same chat-completions request and response shape as the OpenAI API, existing community Go OpenAI clients that let you override the base URL work unchanged. If you would rather not add a dependency, a raw net/http call is short enough to write directly, which also makes it easy to see and log exactly what you are sending and paying for.
A minimal request
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{"model":"openai/gpt-4.1","messages":[{"role":"user","content":"Write a one-line commit message for a bug fix."}]}`)
req, _ := http.NewRequest("POST", "https://api.unoblox.ai/v1/chat/completions", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer ub-gw-xxxxxxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}
Swap the model field to any catalog id; the rest of the function does not change, including for streaming responses, which arrive as server-sent events on the same endpoint.
Choosing a model from Go code
| Use case in a Go service | Model | ₹ per 1M tokens (input / output) |
|---|---|---|
| Background batch jobs | DeepSeek V4 Flash | ₹9.07 / ₹18.14 |
| Request-time enrichment | Llama 4 Scout | ₹10.08 / ₹30.24 |
| User-facing chat feature | GPT-5 | ₹126 / ₹1008 |
| Highest-quality responses | Claude Opus | ₹504 / ₹2520 |
For anything else in the catalog, see live ₹ pricing on /models before hardcoding a model id into a production path.
Handling errors and retries like any HTTP dependency
Treat the unoblox endpoint like any external HTTP dependency in a Go service: check the status code before parsing the body, set a sensible request timeout on your http.Client, and retry transient failures with backoff rather than immediately. Because pricing is metered per token, a retry storm during an outage is also a cost concern, not just a reliability one, so cap retry attempts accordingly.
Frequently asked questions
Do I need an official unoblox Go SDK? No — since the endpoint is OpenAI-compatible, plain net/http or any community Go client that supports a custom base URL works without modification.
Does streaming work with Go's net/http? Yes, read the response body incrementally as server-sent events rather than waiting for the full body, the same way you would stream from any HTTP endpoint in Go.
Can I run this from a Go Lambda or serverless function? Yes, it is a plain outbound HTTPS call, so it works from any Go runtime that has network access, including serverless functions.
Is my request data processed in India? Only for the small unoblox-hosted models; external models like GPT and Claude process requests on their own infrastructure, with unoblox adding rupee billing and a GST invoice rather than India data residency.
How do I test without spending anything? Call Qwen3 1.7B, which is free (₹0), to validate your Go client code before pointing it at a paid model.
Get started in rupees → https://unoblox.ai/sign-in
Start building in rupees
Call every major model through one OpenAI-compatible endpoint, billed in ₹ on a GST invoice.