Every abstraction over a fast-moving API is wrong somewhere. skyl's answer is to be escapable in every direction — you can send fields it does not model, read fields it does not parse, replace the transport, observe every attempt, write your own adapter, or bypass the client entirely.
In this chapter
- How to send a vendor field skyl has no equivalent for
- How to read a response field skyl does not parse
- How to supply your own
*http.Client - How to observe every attempt without touching your call sites
- How to implement
Provideryourself, in your own repository - How to skip
Clientwhen you want the raw provider
Provider options#
req.ProviderOptions = map[string]any{"top_k": 40}req.ProviderOptions = map[string]any{"top_k": 40}Your keys are merged into the outbound payload, overriding anything skyl set.
Read Provider Options — the merge is shallow on three of four adapters, and that will bite you.
Raw responses#
var full map[string]any
json.Unmarshal(resp.Raw, &full)var full map[string]any
json.Unmarshal(resp.Raw, &full)Read Raw Responses for what is guaranteed and what streaming changes.
Your own HTTP client#
Read Custom HTTP Client for proxies, transport timeouts, mTLS, and trace propagation.
Hooks#
Read Hooks for the four operations, and the one field that will leak your users' prompts if you log it.
Your own provider#
Read Writing Your Own Provider — four methods, and you inherit retry, hooks and the gateway for free.
Bypassing the client#
Read Bypassing the Client for when you want the provider without validation or retry.
What’s next?
Start with Provider Options — it is the hatch you will reach for first. If you are here because a vendor feature is missing, that page and Raw Responses between them cover almost every case.