From 370b6a3c2cc51f8e538aa0027843f8a3ee1b8cf3 Mon Sep 17 00:00:00 2001 From: owell andry Date: Tue, 24 Jun 2025 18:19:31 -0500 Subject: [PATCH] Handle numeric error codes --- go/openrouter/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/openrouter/client.go b/go/openrouter/client.go index 5aef27a..83f424c 100644 --- a/go/openrouter/client.go +++ b/go/openrouter/client.go @@ -29,8 +29,8 @@ type chatResponse struct { Message Message `json:"message"` } `json:"choices"` Error struct { - Message string `json:"message"` - Code string `json:"code"` + Message string `json:"message"` + Code interface{} `json:"code"` } `json:"error,omitempty"` } @@ -131,7 +131,7 @@ func (c *Client) chat(model, context, message string, debug bool) (string, error } if r.Error.Message != "" { - return "", fmt.Errorf("API error: %s (code: %s)", r.Error.Message, r.Error.Code) + return "", fmt.Errorf("API error: %s (code: %v)", r.Error.Message, r.Error.Code) } if debug {