w.Header().Set("X-Codex-Plan-Type", "plus")
w.Header().Set("X-Other", "not quota")
w.Header().Set("X-Codex-Turn-State", "opaque state")
w.Header().Set("X-Codex-Plan-Type", "plus")
w.Header().Set("X-Other", "not quota")
w.Header().Set("X-Codex-Turn-State", "opaque state")
"x-codex-primary-used-percent": "12",
"x-codex-plan-type": "plus",
}
"x-codex-primary-used-percent": "12",
"x-codex-plan-type": "plus",
}
require.Equal(t, "gpt-test", records[0].Model)
require.Equal(t, http.StatusOK, records[0].Status)
require.Equal(t, 500, records[0].InputTokens)
require.Equal(t, "gpt-test", records[0].Model)
require.Equal(t, http.StatusOK, records[0].Status)
require.Equal(t, 500, records[0].InputTokens)
_, err := client.Create(t.Context(), modelTestRequest())
require.NoError(t, err)
}
require.True(t, client.LimitReached())
_, err := client.Create(t.Context(), modelTestRequest())
require.NoError(t, err)
}
require.True(t, client.LimitReached())
_, err := client.Create(t.Context(), modelTestRequest())
require.ErrorIs(t, err, errModelCallLimit)
require.Equal(t, 2, server.Calls())
_, err := client.Create(t.Context(), modelTestRequest())
require.ErrorIs(t, err, errModelCallLimit)
require.Equal(t, 2, server.Calls())
events: []any{map[string]any{"type": "response.failed", "response": map[string]any{"error": map[string]any{"code": "server_error", "message": "busy"}}}},
want: "server_error: busy",
},
{
events: []any{map[string]any{"type": "response.failed", "response": map[string]any{"error": map[string]any{"code": "server_error", "message": "busy"}}}},
want: "server_error: busy",
},
{
events: []any{map[string]any{"type": "response.incomplete", "response": map[string]any{"incomplete_details": map[string]any{"reason": "content_filter"}}}},
want: "content_filter",
},
{
events: []any{map[string]any{"type": "response.incomplete", "response": map[string]any{"incomplete_details": map[string]any{"reason": "content_filter"}}}},
want: "content_filter",
},
{
events: []any{map[string]any{"type": "error", "code": "rate_limit", "message": "too many"}},
want: "rate_limit: too many",
},
{
events: []any{map[string]any{"type": "error", "code": "rate_limit", "message": "too many"}},
want: "rate_limit: too many",
},
{
events: []any{map[string]any{"type": "response.output_item.done", "item": modelMessageItem("cut")}},
want: "ended before the response completed",
},
events: []any{map[string]any{"type": "response.output_item.done", "item": modelMessageItem("cut")}},
want: "ended before the response completed",
},