Call the Responses API from Go over plain HTTP.
POST /v1/responses speaks the Responses shape. An OpenAI-compatible Go client pointed at https://opendunes.com/v1 drives it through its responses service — check your installed SDK version's own documentation for the call shape. The wire surface below is the contract any Go HTTP client can target directly.
body, _ := json.Marshal(map[string]any{
"model": "openai/gpt-5.1",
"instructions": "You answer Souk customers in French.",
"input": "Quels sont vos horaires le vendredi ?",
})
req, _ := http.NewRequest("POST", "https://opendunes.com/v1/responses", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("OPENDUNES_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
// resp body: { "id": "resp_…", "status": "completed", "output": [ … ], "usage": { …, "cost": <DA> } }The text is in the output item of type message, under content[].text. usage.cost is the charge in DA; the answer carries X-Generation-Id.
Add "stream": true and read the body as server-sent events: response.output_text.delta events carry the text, and the closing response.completed event carries the usage with cost in DA.
The API is stateless: nothing is kept between requests, and previous_response_id is refused with a 400. Send the conversation again each turn — the earlier output items can go straight back into input, followed by the new user message.
An error comes back as a failed response — { "id", "status": "failed", "error": { "code", "message" }, "error_type" } — at its HTTP status. See Errors.