@@ -9,6 +9,7 @@ import (
99 "log/slog"
1010 "regexp"
1111 "strconv"
12+ "strings"
1213 "time"
1314
1415 "github.com/anthropics/anthropic-sdk-go"
@@ -270,6 +271,7 @@ func (a *anthropicClient) stream(ctx context.Context, messages []message.Message
270271 anthropicStream := a.client.Messages.NewStreaming(
271272 ctx,
272273 preparedMessages,
274+ option.WithHeaderAdd("anthropic-beta", "interleaved-thinking-2025-05-14"),
273275 )
274276 accumulatedMessage := anthropic.Message{}
275277
@@ -426,7 +428,8 @@ func (a *anthropicClient) shouldRetry(attempts int, err error) (bool, int64, err
426428 }
427429 }
428430
429− if apiErr.StatusCode != 429 && apiErr.StatusCode != 529 {
431+ isOverloaded := strings.Contains(apiErr.Error(), "overloaded") || strings.Contains(apiErr.Error(), "rate limit exceeded")
432+ if apiErr.StatusCode != 429 && apiErr.StatusCode != 529 && !isOverloaded {
430433 return false, 0, err
431434 }
432435